<%= title l(:label_product) %>
<%= render partial: "wkproduct/render_inventory_tabs" %>
<%= form_tag({:controller => 'wkproduct', :action => 'index'}, :method => :get, :id => 'query_form') do %>
	<%= hidden_field_tag "searchlist", controller_name %>
	<%=h hidden_field_tag('tab', controller_name) %>
	<%
		categoryId =session[controller_name].try(:[], :category_id)
		name =session[controller_name].try(:[], :name)
	%>
	<fieldset>
		<div style="float:right">
			<%= link_to l(:label_new_product), url_for(:controller => controller_name, :action => 'edit'), :class => 'icon icon-add' %>&nbsp;
			<%= render :partial => 'sidebar' %>
		</div>
		<table>
			<tr>
				<%=h hidden_field_tag('tab', "wkproduct") %>
				<th><label ><%= l(:field_category) %></label></th>
				<td><%=h select_tag("category_id", generic_options_for_select(WkProductCategory, nil, 'name', 'name', 'id', categoryId, true), :disabled => false) %></td>
				<th><label for='name' style="padding-left: 10px;"><%= l(:field_name) %></label><th>
				<td><%= text_field_tag 'name', name, :size => 30 %></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 @productEntries.present? %>
	<%= render :partial => 'wkproduct/product_list'%>
	<% other_formats_links do |f| %>
		<%= f.link_to_with_query_parameters 'CSV', {} %>
	<% end %>
<% else %>
	<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>