<%= error_messages_for 'time_entry' %>
<%= back_url_hidden_field_tag %>

<%=h hidden_field_tag('getissues_url', "#{url_for(:controller => controller.controller_name, :action => 'getissues')}") %>
<%=h hidden_field_tag('getactivities_url', "#{url_for(:controller => controller.controller_name, :action => 'getactivities')}") %>
<%=h hidden_field_tag('getclients_url', "#{url_for(:controller => controller.controller_name, :action => 'getclients', :user_id => @user.id)}") %>
<%=h hidden_field_tag('deleterow_url', "#{url_for(:controller => controller.controller_name, :action => 'deleterow')}") %>
<% manage_others_log = User.current.id == params[:user_id].to_i ? ((@logtime_projects || []).pluck(:id)).to_s : ((@manage_others_log || []).pluck(:id)).to_s %>
<tr>
	<th align="right"><%=l(:field_user)%></th>
	<td>
		<% if @manage_projects.present? && @manage_projects.size > 0 || @manage_others_log.present? && @manage_others_log.size > 0 %>
			<%= select_tag('user_id', options_for_select(@users, selected: @user.id), style: "width:150px;", class: "load") %>
			<%= hidden_field_tag(:manage_others_log, manage_others_log) %>
			<%= hidden_field_tag(:manage_edit_projects, (@manage_projects || []).pluck(:id)) %>
		<% else %>
			<%= @user.name %>
			<%= hidden_field_tag('user_id', @user.id) %>
		<% end %>
	</td>
</tr>
<%= hidden_field_tag('project_id', @projectId) %>
<%= hidden_field_tag('selected_date', @selectedDate) %>
<%= hidden_field_tag(:logtime_projects, (@logtime_projects && (@logtime_projects || []).pluck(:id)).to_s) %>
<%= hidden_field_tag(:edit_own_logs, (@edit_own_logs && (@edit_own_logs || []).pluck(:id)).to_s) %>
<%= hidden_field_tag(:current_user, User.current.id == params[:user_id].to_i) %>
<% @startday = @selectedDate if @renderer.useSelectedDtAsStart %>
<tr>
	<th align="right"><%=l(:field_start_date)%></th>
	<td>
		<%= date_field_tag('startday', @startday, required: true, class: "load") %>
	</td>
</tr>
<% # Martin Dube Contribution: show previous and next time entry %>
<tr>
	<th></th>
	<td>
		<%= link_to("\xc2\xab " + l(:label_previous ), {:controller => controller.controller_name, :action => 'edit', :startday => @startday - @renderer.getDaysPerSheet, :user_id => @user.id, :project_id => params[:project_id], :sheet_view => @renderer.getSheetType},
								:title => l(:label_wk_prev_week_tip)) %>
		|
		<%= link_to(l(:label_next) + " \xc2\xbb", {:controller => controller.controller_name, :action => 'edit', :startday => @startday + @renderer.getDaysPerSheet, :user_id => @user.id, :project_id => params[:project_id], :sheet_view => @renderer.getSheetType},
								:title => l(:label_next_week)) %>
	</td>
</tr>
<% if @renderer.showTEStatus %>
<tr>
	<th align="right"><%=l(:field_status)%></th>
	<% # the default status on new wktime object is 'new' %>
	<td>
		<%=h statusString(@wktime.status) unless @wktime.blank? %>
	</td>
</tr>
<tr>
	<th align="right"><%=l(:label_submitted_by)%></th>
	<td>
	<% status = @wktime.status unless @wktime.blank? %>
	<% if (status != 'n' && status != 'r'  )  %>
	<%=h @wktime.blank? ? "" : (@wktime.submitter.name unless @wktime.submitter.blank?) %>
	<% end %>	
	</td>
</tr>
<tr>
	<th align="right"><%=l(:label_approved_by)%></th>
	<td><% if (status == 'a')  %>
	<%=h @wktime.blank? ? "" : (@wktime.updater.name unless @wktime.updater.blank?) %>
		<% end %>
	</td>
</tr>
<% end%>