Skip to content

Commit

Permalink
imp: Display the total time spent in the tickets
Browse files Browse the repository at this point in the history
  • Loading branch information
marien-probesys committed Dec 10, 2024
1 parent 97189b5 commit 12fd603
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 1 deletion.
59 changes: 58 additions & 1 deletion templates/tickets/show.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,66 @@
{% endif %}
</div>

<div class="ticket__info-separator"></div>
{% set canSeeAccountedTimeSpent = is_granted('orga:see:tickets:time_spent:accounted', organization) %}
{% set canSeeRealTimeSpent = is_granted('orga:see:tickets:time_spent:real', organization) %}

{% if canSeeAccountedTimeSpent or canSeeRealTimeSpent %}
<div class="ticket__info-separator"></div>

<div class="flow">
<div class="cols cols--center cols--always flow">
<h2 class="col--extend">
{{ 'tickets.time_spent' | trans }}
</h2>
</div>

{% if canSeeRealTimeSpent and canSeeAccountedTimeSpent %}
<p>
<span class="text--secondary">
{{ 'tickets.time_spent.real' | trans }}
</span>

{{ ticket.sumTimeSpent('real') | formatMinutes('long') }}
</p>

<p>
<span class="text--secondary">
{{ 'tickets.time_spent.accounted' | trans }}
</span>

{{ ticket.sumTimeSpent('accounted') | formatMinutes('long') }}
</p>

<p>
<span class="text--secondary">
{{ 'tickets.time_spent.unaccounted' | trans }}
</span>

{{ ticket.sumTimeSpent('unaccounted') | formatMinutes('long') }}
</p>
{% elseif canSeeRealTimeSpent %}
<p>
<span class="text--secondary">
{{ 'tickets.time_spent.total' | trans }}
</span>

{{ ticket.sumTimeSpent('real') | formatMinutes('long') }}
</p>
{% elseif canSeeAccountedTimeSpent %}
<p>
<span class="text--secondary">
{{ 'tickets.time_spent.total' | trans }}
</span>

{{ ticket.sumTimeSpent('accounted') | formatMinutes('long') }}
</p>
{% endif %}
</div>
{% endif %}

{% if is_granted('orga:see:tickets:contracts', organization) %}
<div class="ticket__info-separator"></div>

<div class="flow">
<div class="cols cols--center cols--always flow">
<h2 class="col--extend">
Expand Down
4 changes: 4 additions & 0 deletions translations/messages+intl-icu.en_GB.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,10 @@ tickets.status.resolved: Resolved
tickets.team: 'Team in charge'
tickets.team.none: 'No team'
tickets.time_spent: 'Time spent'
tickets.time_spent.accounted: 'Accounted time:'
tickets.time_spent.real: 'Real time:'
tickets.time_spent.total: 'Total time:'
tickets.time_spent.unaccounted: 'Unaccounted time:'
tickets.timeline.diff_days: '{days} days later'
tickets.timeline.today: (today)
tickets.title: Title
Expand Down
4 changes: 4 additions & 0 deletions translations/messages+intl-icu.fr_FR.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,10 @@ tickets.status.resolved: Résolu
tickets.team: 'Équipe responsable'
tickets.team.none: 'Aucune équipe'
tickets.time_spent: 'Temps passé'
tickets.time_spent.accounted: "Temps comptabilisé\_:"
tickets.time_spent.real: "Temps réel\_:"
tickets.time_spent.total: "Temps total\_:"
tickets.time_spent.unaccounted: "Temps non comptabilisé\_:"
tickets.timeline.diff_days: '{days} jours plus tard'
tickets.timeline.today: (aujourd’hui)
tickets.title: Titre
Expand Down

0 comments on commit 12fd603

Please sign in to comment.