<%= stylesheet_link_tag 'wk-time', :plugin => "redmine_wktime" %>
<h2><%= l(:label_models) %></h2>
<%= form_tag({:controller => "wkbrand", :action => 'updateProductModel'}, :method => :post, :id => 'query_form') do %>
	<fieldset class="box tabular" >
	<legend><%= l(:label_details) %></legend>
	<%=h hidden_field_tag('product_model_id', @modelEntry.blank? ? nil : @modelEntry.id) %>
	<%=h hidden_field_tag('brand_id', @brand.blank? ? nil : @brand.id) %>
	<table >
		<tr>
			<th align="left"><%= l(:field_name) %></th>
			<td align="left" style="padding-left:40px;"><%=h text_field_tag("name",@modelEntry.blank? ? nil : @modelEntry.name, :required => true,:size => 85) %> </td></tr>
		</tr>
		<tr>
			<th align="left"><%= l(:label_product) %></th>
			<td align="left" style="padding-left:40px;">
				<%=h select_tag("product_id", generic_options_for_select(WkProduct, " id in (select product_id from wk_brand_products where brand_id = #{@brand.id})", 'name', 'name', 'id', @modelEntry.blank? ? nil : @modelEntry.product_id, false)) %>
			</td>
		</tr>
		<tr>
			<th align="left"><%= l(:label_brand) %></th>
			<td align="left" style="padding-left:40px;">
				<%=h select_tag("hidden_brand_id", generic_options_for_select(WkBrand, nil, 'name', 'name', 'id', @modelEntry.blank? ? @brand.id : @modelEntry.brand_id, false), :disabled => true ) %>
			</td>
		</tr>
		<tr>
			<th align="left"><%= l(:field_description) %></th>
			<td colspan=4 align="left" style="padding-left:40px;"><%=h text_area_tag("description",@modelEntry.blank? ? '' : @modelEntry.description, :maxlength => 255, :style => "width:600px; height:90px;") %> </td>
		</tr>
		<% if @modelEntry.blank? %>
			<tr>
				<th align="left" style="width: 150px;"><%=  l(:label_automatic_product_item)  %></th>
				<td colspan=4 align="left" style="padding-left:40px;">
					<%= check_box_tag 'automatic_product_item' %>
				</td>
			</tr>
			<tr id="tr_part_number">
				<th align="left" style="width: 150px;"><%= l(:label_part_number) %></th>
				<td colspan=4 align="left" style="padding-left:40px;">
					<%= text_field_tag("mod_part_number") %>
				</td>
			</tr>
		<% end %>
	</table>
</fieldset>
	<%= submit_tag l(:button_save), :class => "small", :name => nil %>
<% end %>