diff --git a/scipost_django/finances/templates/finances/_worklog_summary_table.html b/scipost_django/finances/templates/finances/_worklog_summary_table.html new file mode 100644 index 0000000000000000000000000000000000000000..889d2e82bcdc8381af22bf66e9328f56ca2f6d26 --- /dev/null +++ b/scipost_django/finances/templates/finances/_worklog_summary_table.html @@ -0,0 +1,31 @@ +{% load scipost_extras %} + +<table class="table table-hover text-nowrap"> + <thead class="table-light"> + <tr> + <th>Employee</th> + + {% for month in logs_filter_form.get_months %}<th colspan="2" scope="colgroup">{{ month|date:'N Y' }}</th>{% endfor %} + + </tr> + </thead> + <tbody> + + {% for user_data in logs_filter_form.filter_per_month %} + <tr> + <td>{{ user_data.user.contributor }}</td> + + {% for _, total_time, monthly_salary in user_data.monthly_data %} + <td>{{ total_time|duration }}</td> + <td>€{{ monthly_salary|floatformat:0 }}</td> + {% endfor %} + + </tr> + {% empty %} + <tr> + <td colspan="5">No logs found.</td> + </tr> + {% endfor %} + + </tbody> +</table> diff --git a/scipost_django/finances/templates/finances/timesheets.html b/scipost_django/finances/templates/finances/timesheets.html index 499ad4fc2d6b2120842b5c5330faa3ead566834a..380f78ea4bd3c2e55b8f0e3341a6e3b16b72462b 100644 --- a/scipost_django/finances/templates/finances/timesheets.html +++ b/scipost_django/finances/templates/finances/timesheets.html @@ -32,29 +32,7 @@ {% if form.is_bound and form.is_valid %} <h2 class="mb-2 mt-4">Team timesheets</h2> <h4 class="mb-1">{{ user_log.user.first_name }} {{ user_log.user.last_name }}</h4> - <table class="table table-hover text-nowrap"> - <thead class="table-light"> - <tr> - <th>Employee</th> - {% for month in form.get_months %}<th colspan="2" scope="colgroup">{{ month|date:'N Y' }}</th>{% endfor %} - </tr> - </thead> - <tbody> - {% for user_data in form.filter_per_month %} - <tr> - <td>{{ user_data.user.contributor }}</td> - {% for _, total_time, monthly_salary in user_data.monthly_data %} - <td>{{ total_time|duration }}</td> - <td>€{{ monthly_salary|floatformat:0 }}</td> - {% endfor %} - </tr> - {% empty %} - <tr> - <td colspan="5">No logs found.</td> - </tr> - {% endfor %} - </tbody> - </table> + {% include "finances/_worklog_summary_table.html" with logs_filter_form=form %} {% else %} <p class="text-danger">First submit the filter form to retrieve results.</p> {% endif %}