billable timesheets, inactive projects report, bookmark export search (#2503)

This commit is contained in:
Kevin Papst
2021-04-18 21:51:27 +02:00
committed by GitHub
parent 8664d94ea6
commit 0330f45c6a
97 changed files with 1516 additions and 664 deletions

View File

@@ -1,21 +1,10 @@
{% macro progressbar(max, current, title, subTitle) %}
{% macro progressbar(max, current, title, subTitle, reverseColors) %}
{% set percentReached = 0 %}
{% if max > 0 %}
{% set percentReached = (current / (max / 100)) %}
{% endif %}
{% set class = "progress-bar-info" %}
{% set width = percentReached|number_format(1, '.', '') %}
{% if percentReached > 90 %}
{% set class = "progress-bar-danger" %}
{% elseif percentReached > 70 %}
{% set class = "progress-bar-warning" %}
{% elseif percentReached > 50 %}
{% set class = "progress-bar-success" %}
{% elseif percentReached > 30 %}
{% set class = "progress-bar-primary" %}
{% endif %}
{% if width > 100 %}
{% set width = 100 %}
{% endif %}
@@ -35,36 +24,25 @@
</span>
</div>
<div class="progress">
<div class="progress-bar {{ class }}" role="progressbar" aria-valuenow="{{ width }}" aria-valuemin="0" aria-valuemax="100" style="width: {{ width }}%"></div>
<div class="progress-bar {{ progressbar_color(percentReached, reverseColors) }}" role="progressbar" aria-valuenow="{{ width }}" aria-valuemin="0" aria-valuemax="100" style="width: {{ width }}%"></div>
</div>
</div>
{% endmacro %}
{% macro progressbar_small(max, current, leftValue, leftFormatted) %}
{% macro progressbar_small(max, current, leftValue, leftFormatted, reverseColors) %}
{% set percentReached = 0 %}
{% if max > 0 %}
{% set percentReached = (current / (max / 100)) %}
{% endif %}
{% set class = "progress-bar-info" %}
{% set width = percentReached|number_format(1, '.', '') %}
{% if percentReached > 90 %}
{% set class = "progress-bar-danger" %}
{% elseif percentReached > 70 %}
{% set class = "progress-bar-warning" %}
{% elseif percentReached > 50 %}
{% set class = "progress-bar-success" %}
{% elseif percentReached > 30 %}
{% set class = "progress-bar-primary" %}
{% endif %}
{% if width > 100 %}
{% set width = 100 %}
{% endif %}
<div class="progress-group">
<div class="progress progress-sm">
<div class="progress-bar {{ class }}" role="progressbar" aria-valuenow="{{ width }}" aria-valuemin="0" aria-valuemax="100" style="width: {{ width }}%"></div>
<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 leftValue is not null and leftValue > 0 %}
<small>{{ 'stats.percentUsedLeft'|trans({'%percent%': percentReached|number_format(0), '%left%': leftFormatted}) }}</small>

View File

@@ -504,17 +504,105 @@
{% endif %}
{% endmacro %}
{# To be used mainly in <tr class="{{ class_customer_row(customer, now) }}"> #}
{#
To be used like this:
<tr class="{{ class_customer_row(customer, now) }}">
#}
{% macro class_customer_row(customer, now) %}
{%- if not customer.visible %}warning{% endif -%}
{% endmacro %}
{# To be used mainly in <tr class="{{ class_project_row(project, now) }}"> #}
{#
To be used like this:
<tr {{ customer_row_attr(customer, now) }}>
#}
{% macro customer_row_attr(customer, now) %}
{%- set class = _self.class_customer_row(customer, now) %}
{% set dataHref = '' %}
{% if is_granted('view', customer) %}
{% set class = class ~ ' alternative-link open-edit' %}
{% set dataHref = path('customer_details', {'id': customer.id}) %}
{% endif -%}
class="{{ class }}" data-href="{{ dataHref }}"
{% endmacro %}
{#
To be used like this:
<tr class="{{ class_project_row(project, now) }}">
#}
{% macro class_project_row(project, now) %}
{%- if not project.visible or (project.end is not null and project.end < now) %}warning{% endif -%}
{% endmacro %}
{# To be used mainly in <tr class="{{ class_activity_row(activity, now) }}"> #}
{#
To be used like this:
<tr {{ project_row_attr(project, now) }}>
#}
{% macro project_row_attr(project, now) %}
{%- set class = _self.class_project_row(project, now) %}
{% set dataHref = '' %}
{% if is_granted('view', project) %}
{% set class = class ~ ' alternative-link open-edit' %}
{% set dataHref = path('project_details', {'id': project.id}) %}
{% endif -%}
class="{{ class }}" data-href="{{ dataHref }}"
{% endmacro %}
{#
To be used like this:
<tr {{ class_activity_row(activity, now) }}>
#}
{% macro class_activity_row(activity, now) %}
{%- if not activity.visible %}warning{% endif -%}
{% endmacro %}
{#
To be used like this:
<tr {{ activity_row_attr(activity, now) }}>
#}
{% macro activity_row_attr(activity, now) %}
{%- set class = _self.class_activity_row(activity, now) %}
{% set dataHref = '' %}
{% if is_granted('view', activity) %}
{% set class = class ~ ' alternative-link open-edit' %}
{% set dataHref = path('activity_details', {'id': activity.id}) %}
{% endif -%}
class="{{ class }}" data-href="{{ dataHref }}"
{% endmacro %}
{#
To be used like this:
<tr class="{{ class_user_row(user, now) }}">
#}
{% macro class_user_row(user) %}
{%- if not user.enabled %}warning{% endif -%}
{% endmacro %}
{#
To be used like this:
<tr {{ user_row_attr(user) }}>
#}
{% macro user_row_attr(user) %}
{%- set class = _self.class_user_row(user) %}
{% set dataHref = '' %}
{% if is_granted('view', user) %}
{% set class = class ~ ' alternative-link open-edit' %}
{% set dataHref = path('user_profile', {'username': user.username}) %}
{% endif -%}
class="{{ class }}" data-href="{{ dataHref }}"
{% endmacro %}
{# To be used mainly in <tr class="{{ class_user_row(user, now) }}"> #}
{% macro short_stats_row(stats) %}
<div class="row">
{% set colLength = 12 / stats|length %}
{% for title, value in stats %}
<div class="col-sm-{{ colLength }} border-right">
<div class="description-block">
<h5 class="description-header">{{ value }}</h5>
<span class="description-text">{{ title }}</span>
</div>
</div>
{% endfor %}
</div>
{% endmacro %}