0
0
Fork 0
mirror of https://github.com/kevinpapst/kimai2.git synced 2025-03-31 19:54:56 +00:00

show budget and time-budget columns in listing views ()

This commit is contained in:
Kevin Papst 2021-03-13 20:44:10 +01:00 committed by GitHub
parent 3e9371bd6a
commit ec0eca39ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 6 deletions

View file

@ -92,6 +92,7 @@ final class ActivityController extends AbstractController
'query' => $query,
'toolbarForm' => $form->createView(),
'metaColumns' => $this->findMetaColumns($query),
'defaultCurrency' => $this->configuration->getCustomerDefaultCurrency()
]);
}

View file

@ -62,7 +62,10 @@ class UserTeamProjects extends SimpleWidget implements AuthorizedWidget, UserWid
foreach ($projects as $id => $project) {
if ($project->getBudget() > 0 || $project->getTimeBudget() > 0) {
$stats[] = $this->repository->getProjectStatistics($project);
$stats[] = [
'project' => $project,
'stats' => $this->repository->getProjectStatistics($project),
];
}
}

View file

@ -15,6 +15,8 @@
}) %}
{% endfor %}
{% set columns = columns|merge({
'budget': {'class': 'hidden-xs hidden-sm hidden', 'title': 'label.budget'|trans},
'timeBudget': {'class': 'hidden-xs hidden-sm hidden', 'title': 'label.timeBudget'|trans},
'team': {'class': 'text-center w-min', 'orderBy': false},
'visible': {'class': 'text-center hidden w-min'},
'actions': {'class': 'actions alwaysVisible'},
@ -58,6 +60,8 @@
{{ tables.datatable_meta_column(entry, field) }}
</td>
{% endfor %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'budget') }}">{{ entry.budget|money((entry.project is null ? defaultCurrency : entry.project.customer.currency)) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'timeBudget') }}">{{ entry.timeBudget|duration }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'team') }}">{{ widgets.badge_team_access(entry.teams) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'visible') }}">{{ widgets.label_visible(entry.visible) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'actions') }}">{{ actions.activity(entry, 'index') }}</td>

View file

@ -26,6 +26,8 @@
}) %}
{% endfor %}
{% set columns = columns|merge({
'budget': {'class': 'hidden-xs hidden-sm hidden', 'title': 'label.budget'|trans},
'timeBudget': {'class': 'hidden-xs hidden-sm hidden', 'title': 'label.timeBudget'|trans},
'team': {'class': 'text-center w-min', 'orderBy': false},
'visible': {'class': 'text-center hidden w-min'},
'actions': {'class': 'actions alwaysVisible'},
@ -69,6 +71,8 @@
{{ tables.datatable_meta_column(entry, field) }}
</td>
{% endfor %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'budget') }}">{{ entry.budget|money(entry.currency) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'timeBudget') }}">{{ entry.timeBudget|duration }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'team') }}">{{ widgets.badge_team_access(entry.teams) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'visible') }}">{{ widgets.label_visible(entry.visible) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'actions') }}">{{ actions.customer(entry, 'index') }}</td>

View file

@ -19,6 +19,8 @@
}) %}
{% endfor %}
{% set columns = columns|merge({
'budget': {'class': 'hidden-xs hidden-sm hidden', 'title': 'label.budget'|trans},
'timeBudget': {'class': 'hidden-xs hidden-sm hidden', 'title': 'label.timeBudget'|trans},
'team': {'class': 'text-center w-min', 'orderBy': false},
'visible': {'class': 'text-center hidden w-min'},
'actions': {'class': 'actions alwaysVisible'},
@ -55,6 +57,8 @@
{{ tables.datatable_meta_column(entry, field) }}
</td>
{% endfor %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'budget') }}">{{ entry.budget|money(entry.customer.currency) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'timeBudget') }}">{{ entry.timeBudget|duration }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'team') }}">{{ widgets.badge_team_access(entry.teams) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'visible') }}">{{ widgets.label_visible(entry.visible) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'actions') }}">{{ actions.project(entry, 'index') }}</td>

View file

@ -16,13 +16,14 @@
{% block box_body %}
<table class="table table-hover dataTable" role="grid">
<tbody>
{% for stats in projectStats|sort((a, b) => a.project.name <=> b.project.name) %}
{% set project = stats.project %}
<tr{% if is_granted('details', stats.project) %} class="alternative-link open-edit" data-href="{{ path('project_details', {'id': stats.project.id}) }}"{% endif %}>
{% for row in projectStats|sort((a, b) => a.project.name <=> b.project.name) %}
{% set stats = row.stats %}
{% set project = row.project %}
<tr{% if is_granted('details', project) %} class="alternative-link open-edit" data-href="{{ path('project_details', {'id': project.id}) }}"{% endif %}>
<td>
{{ widgets.label_project(stats.project) }}
{{ widgets.label_project(project) }}
<br>
<small>{{ widgets.label_customer(stats.project.customer) }}</small>
<small>{{ widgets.label_customer(project.customer) }}</small>
</td>
<td class="hidden-xs hidden-sm hidden-md">
{% for team in project.teams %}

View file

@ -455,6 +455,7 @@ class TimesheetControllerTest extends ControllerBaseTest
'hourlyRate' => 100,
'begin' => '2020-02-18 01:00',
'end' => '2020-02-18 02:10',
'duration' => '01:10',
'project' => 1,
'activity' => $activity->getId(),
]