<%= link_to sprite_icon(:reload, l(:label_stopwatch_refresh)), stopwatch_running_timers_path, class: 'icon icon-reload' %>

<%= l(:label_stopwatch_running_timers) %>

<% if @rows.empty? %>

<%= l(:label_stopwatch_no_running_timers) %>

<% else %>
<% @rows.each do |row| %> <% entry = row.time_entry %> <% end %>
<%= l(:field_user) %> <%= l(:field_issue) %> <%= l(:field_project) %> <%= l(:field_activity) %> <%= l(:label_stopwatch_started_at) %> <%= l(:label_stopwatch_running_for) %> <%= l(:label_stopwatch_entry_total) %>
<%= avatar(row.user, size: 16) %> <%= link_to_user row.user %> <% if row.issue %> <%= row.issue.visible? ? link_to_issue(row.issue, truncate: 60) : "##{row.issue.id}" %> <% end %> <%= link_to_project(row.project) if row.project %> <%= entry&.activity %> <%= row.started_at ? format_time(row.started_at) : content_tag(:span, l(:label_stopwatch_unknown_start), class: 'stopwatch-unknown', title: l(:text_stopwatch_unknown_start)) %> <%= html_hours(format_hours(row.timer.session_hours)) %> <%= html_hours(format_hours(row.timer.time_spent)) %> <% if row.stoppable_by?(User.current) %> <%= form_tag stop_stopwatch_running_timer_path(row.user), method: :post, class: 'stopwatch-stop-form', data: { confirm: l(:text_stopwatch_confirm_stop, name: row.user.name) } do %> <% if row.started_at %> <%# Optional: when the person actually stopped working; blank = now %> <%= datetime_local_field_tag :stopped_at, nil, min: User.current.convert_time_to_user_timezone(row.started_at).strftime('%Y-%m-%dT%H:%M'), max: User.current.convert_time_to_user_timezone(Time.now).strftime('%Y-%m-%dT%H:%M'), title: l(:text_stopwatch_stopped_at), 'aria-label': l(:label_stopwatch_stopped_at), id: "stopped_at_#{row.user.id}" %> <% end %> <%= submit_tag l(:label_stopwatch_stop_timer), name: nil, class: 'small' %> <% end %> <% end %>

<%= l(:text_stopwatch_running_timers_help) %>

<% end %> <%= javascript_tag do %> // Refresh every minute, unless someone is filling in a stop time (function () { setInterval(function () { var busy = Array.prototype.some.call(document.querySelectorAll('.stopwatch-stop-form input[name="stopped_at"]'), function (el) { return el.value !== '' || el === document.activeElement; }); if (!busy) window.location.reload(); }, 60000); })(); <% end %> <% html_title(l(:label_stopwatch_running_timers)) -%>