<%= stylesheet_link_tag 'wk-time', :plugin => "redmine_wktime" %>
<div class="autoscroll">
<table class="list time-entries">
  <thead>
      <% if action_name == 'index' %>
         <tr>
				<%= sort_header_tag('name', :caption => l(:field_name), class: "lbl-txt-align") %>
				<%= sort_header_tag('acc_name', :caption => l(:label_account_name), class: "lbl-txt-align") %>
				<%= sort_header_tag('location_name', :caption => l(:field_location), class: "lbl-txt-align") %>
				<%= sort_header_tag('title', :caption => l(:field_title), class: "lbl-txt-align") %>
				<th class="lbl-txt-align"><%=  l(:field_mail)  %></th>
				<th class="lbl-txt-align"><%=  l(:label_work_phone)   %></th>
				<%= sort_header_tag('assigned_user_id', :caption => l(:field_assigned_to), class: "lbl-txt-align") %>
				<%= sort_header_tag('updated_at', :caption => l(:label_modified).capitalize, class: "lbl-txt-align") %>
				<th></th>
         </tr>
      <% else %>
         <tr>
				<th class="lbl-txt-align"><%= l(:field_name)   %></th>
				<th class="lbl-txt-align"><%=  l(:label_account_name) %></th>
				<th class="lbl-txt-align"><%= l(:field_location) %></th>
				<th class="lbl-txt-align"><%=  l(:field_title)  %></th>
				<th class="lbl-txt-align"><%=  l(:field_mail)  %></th>
				<th class="lbl-txt-align"><%=  l(:label_work_phone)   %></th>
				<th class="lbl-txt-align"><%=  l(:field_assigned_to)  %></th>
				<th class="lbl-txt-align"><%= l(:label_modified).capitalize %></th>
				<th></th>
         </tr>
	  <% end %>
  </thead>
   <tbody>
	<% contacts.each do |entry| %>
		<tr>
		    <td class="lbl-txt-align"><%=h entry.name  %></td>
			<td class="lbl-txt-align"><%=h entry.account.name unless entry.account.blank?  %></td>
			<td class="lbl-txt-align"><%=h entry.location_id.blank? ? "" : entry.location.name %></td>
			<td class="lbl-txt-align"><%=h entry.title unless entry.title.blank?  %></td>
			<td class="lbl-txt-align"><%=h entry.address.email unless entry.address.blank? %></td>
			<td class="lbl-txt-align"><%=h entry.address.work_phone unless entry.address.blank? %></td>
			<td class="lbl-txt-align"><%=h entry.assigned_user.name(:firstname_lastname) unless  entry.assigned_user.blank? %></td>
			<td class="lbl-txt-align"><%=h entry.updated_at.localtime.strftime("%Y-%m-%d") %></td>
			<td class="lbl-txt-align"><%= link_to image_tag('edit.png'), {:controller => controller.getContactController, :action => 'edit', :contact_id => entry.id, :tab => controller.getContactController, id: entry.id}, :title => l(:button_edit) %>
			<% if controller.deletePermission %>
				<%= link_to image_tag('delete.png'), {:controller => controller.getContactController, :action => 'destroy', :contact_id => entry.id, :tab => controller.getContactController, id: entry.id},  :data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %></td>
			<% end %>
		</tr>
	<% end %>
   </tbody>
</table>
</div>