<%#
# Renders the workload data for one single project for one single user.
# Parameters:
#  * user: The user to render the data for.
#  * project: The project to render
#  * data: The data to render. A hash with issues as keys.
%>

<tbody class="project-total-workload <%= css_group_user_class(group&.id, user&.id) %>">
  <tr>
	<th class="project-description <%=  css_group_user_project_class(group&.id, user&.id, project&.id) %>" scope="row" title="<%= l(:workload_trigger_tooltip) %>">
	  <%= render :partial => 'trigger', :locals => {:trigger_for => css_group_user_project_class(group&.id, user&.id, project&.id) } %>
	  <%= project.to_s %>
	  <% if data[:overdue_number]&.positive? || data[:unscheduled_number]&.positive? %>
		<dl class="additional-project-info">
		  <dt><%= l(:workload_overdue_issues_num) %></dt>
		  <dd><%= data[:overdue_number] %></dd>
		  <dt><%= l(:workload_overdue_issues_hours) %></dt>
		  <dd><%= "%0.2f" % data[:overdue_hours] %></dd>
			<dt class='mt-5'><%= l(:workload_unscheduled_issues_num) %></dt>
		  <dd class='mt-5'><%= data[:unscheduled_number] %></dd>
		  <dt><%= l(:workload_unscheduled_issues_hours) %></dt>
		  <dd><%= "%0.2f" % data[:unscheduled_hours] %></dd>
		</dl>
	  <% end %>
	</th>
	<% # Print the total workload for this project for each day %>
	<%= render :partial => 'total_workload', :locals => { :totalWorkload => data[:total], :user => user } %>
  </tr>
</tbody>
<tbody class="issue-workloads <%= css_group_user_project_class(group&.id, user&.id, project&.id) %>">
  <% # Iterate over all issues for the project %>
  <% issuesForUser = data.keys.select{|x| x.kind_of?(Issue)} %>
     <% issuesForUser.each_with_index do |issue, index| %>

     <%= render :partial => 'workload_for_issue', :locals => { :group => group, :user => user, :issue => issue, :data => data[issue], :index => index } %>
  <% end %>
</tbody>