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

48 lines
2.1 KiB
Plaintext
Raw Normal View History

2022-04-18 01:01:57 +00:00
<table class="table main-list">
<thead>
<tr>
<th><%= t("ruling_timer.ticket_no") %></th>
<th><%= t("ruling_timer.priority") %></th>
<th><%= t("ruling_timer.project") %></th>
<th><%= t("ruling_timer.task_name") %></th>
<th><%= t(:tags) %></th>
<th><%= t("ruling_timer.owner") %></th>
<th><%= t("ruling_timer.progress") %></th>
<th><%= t("ruling_timer.task_status") %></th>
<th><%=t("action")%></th>
</tr>
</thead>
<tbody>
<% tasks.each_with_index do |task,i| %>
<tr>
<td class="ticket_no_td"><%=task.ticket_no%></td>
<td class="priority_td"><%=task.get_priority%></td>
<td class="project_td"><%= task.ruling_timer_project.get_project_name rescue "" %></td>
<td class="task_name_td"><%=task.task_name%></td>
<td class="tags_td"></td>
<td class="owner_td"><%=task.owner.name rescue "" %></td>
<td class="progress_td"><%=task.progress%>%</td>
<td class="task_performer_td">
<% 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 %>
<% next if sub_task.nil? %>
<% klass = (sub_task.status == 'working' ? 'fa-play' : (sub_task.status == 'finish' ? 'fa-flag-checkered' : 'fa-pause') rescue 'fa-pause') %>
<span><%=user.name%>( <i class="fa <%=klass%> <%=sub_task.status%>_label"></i> <%=sub_task.get_infos["work"] rescue "00:00:00" %> )</span>
<br>
<% end %>
<% end %>
</td>
<td>
<a href="<%=view_task_admin_ruling_timer_path(:id=>task.id)%>" class="btn btn-primary"><%=t("view")%></a>
<a href="<%=edit_task_admin_ruling_timer_path(:id=>task.id,:project_id=>(params[:id].present? ? params[:id] : nil)) %>" class="btn btn-primary"><%=t("edit")%></a>
<a href="#" class="btn btn-danger delete_task" data-task="<%=task.task_name%>" data-task-id="<%=task.id.to_s%>"><%=t("ruling_timer.delete_task")%></a>
</td>
</tr>
<% end %>
</tbody>
</table>