<%= javascript_include_tag 'index', :plugin => "redmine_wktime" %>

<%= form_tag({:controller => "wklead", :action => 'index'}, :method => :get, :id => 'query_form') do %>
	<%= hidden_field_tag "searchlist", controller_name %>
	<fieldset>
		<div style="float:right">
			<%= link_to l(:label_new_item, l(:label_lead)), url_for(:controller => controller_name, :action => 'edit', id: nil), :class => 'icon icon-add' %>
		</div>
		<table>
			<tr>
				<%=h hidden_field_tag('tab', "wklead") %>
				<th><label for='name'><%= l(:label_lead) %></label></th>
				<td><%= text_field_tag 'lead_name', session[controller_name].try(:[], :lead_name), :size => 30 %></td>
				<th><label style="padding-left: 10px;"><%= l(:field_status) %></label></th>
				<td><%=h select_tag('status', options_for_select(getLeadStatusArr.except!("C").invert, :selected => session[controller_name].try(:[], :status))) %></td>
				<th><label for='location' style="padding-left: 10px;"><%= l(:field_location) %></label></th>
				<td><%=h select_tag("location_id", generic_options_for_select(WkLocation, nil, 'name', 'name', 'id', session[controller_name].try(:[], :location_id), true)) %></td>
				<td><%= submit_tag l(:button_apply), :class => "small", :name => nil %></td>
				<td><%= link_to l(:button_clear), {tab: controller_name, clear: true}, class: 'icon icon-reload' %></td>
			</tr>
		</table>
	</fieldset>
<% end %>

<% if @leadEntries.present? %>
	<%= render :partial => 'lead_list', locals: { entries: @leadEntries } %>
	<% other_formats_links do |f| %>
	<%= f.link_to_with_query_parameters 'CSV', {} %>
	<% end %>
<% else %>
	<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>