ruling_timer/app/views/admin/ruling_timers/view_task.html.erb

66 lines
2.2 KiB
Plaintext
Raw Normal View History

2021-07-21 07:37:06 +00:00
<style type="text/css">
.working_label{
color: #5a5a5a;
font-weight: bold;
}
.finish_label{
color: #3ec700;
font-weight: bold;
}
.stop_label{
color: #cd1643;
font-weight: bold;
}
</style>
<fieldset>
<legend><h3><%= @task.task_name%></h3></legend>
<div class="field_body">
<table class="table main-list">
<thead>
<tr>
<th><%= t("ruling_timer.task_performer") %></th>
<th><%= t("ruling_timer.task_execution_time") %></th>
</tr>
</thead>
<tbody>
<% if @task.user_ids %>
<% user_ids = @task.user_ids
user_bson_ids = user_ids.map{|id| BSON::ObjectId(id)}
%>
<% users = User.find(user_ids).index_by(&:id).slice(*user_bson_ids).values %>
<% users.each do |user| %>
<% sub_task = @task.ruling_timer_sub_tasks.where(:user=>user).first %>
<% klass = (sub_task.status == 'working' ? 'fa-play' : (sub_task.status == 'finish' ? 'fa-flag-checkered' : 'fa-pause') rescue 'fa-pause') %>
<tr>
<td><%=user.name%></td>
<td>
<% work_times = sub_task.get_work_times %>
<% work_times.each_with_index do |work_time,i| %>
<% next if i % 2 == 1 %>
<% next_time = work_times[i+1] %>
<% next_time = "Now" if next_time.nil? %>
<%= "#{work_time} ~ #{next_time}" %>
<br>
<% end %>
<div style="clear: both;"></div>
<span class="<%=sub_task.status%>_label"><i class="fa <%=klass%>"></i><%=t("ruling_timer.#{sub_task.status}")%></span>( <%=t("ruling_timer.total")%>: <%=sub_task.get_infos["work"] rescue "00:00:00" %> )
</td>
</tr>
<br>
<% end %>
<% end %>
</tbody>
</table>
</div>
</fieldset>
<%=
content_tag :div, class: "bottomnav clearfix" do
referer = request.referer rescue nil
referer = task_management_admin_ruling_timers_path if referer.blank? || request.host != URI.parse(URI.encode(referer)).host
link_to(t('ruling_timer.back'), referer, :class=>"btn")
end %>
<style>
.bottomnav{
text-align: center;
}
</style>