<%= f.select :kind, [[l(:label_cost_based_deliverable), CostBasedDeliverable.name], [l(:label_fixed_deliverable), FixedDeliverable.name]], {:required => true, :prompt => true }, :autocomplete => 'off' %>

<%= observe_field :deliverable_kind, :url => { :action => :new }, :update => :content, :with => "Form.serialize('deliverable-form')" %>

<%= f.text_field :subject, :size => 80, :required => true %>

<%= f.text_area :description, :cols => 60, :rows => (@deliverable.description.blank? ? 10 : [[10, @deliverable.description.length / 50].max, 100].min), :accesskey => accesskey(:edit), :class => 'wiki-edit' %>

<% if @deliverable.kind == "CostBasedDeliverable" -%>
<% if User.current.allowed_to?(:view_unit_price, @project)%><%end%> <% @deliverable.deliverable_costs.each do |c| %> <%= render :partial => 'deliverable_costs_row', :locals => {:deliverable_cost => c} %> <% end %> <% if @deliverable_costs_new @deliverable_costs_new.each_with_index do |c, i| %> <%= render :partial => 'deliverable_costs_row', :locals => {:deliverable_cost => c, :row_id => i + 1, :suffix => 'new'} %> <% end end %> <%= render :partial => 'deliverable_costs_row', :locals => {:row_id => deliverable_costs_row_id, :suffix => "new"} %>
<%= l(:caption_cost_unit_plural)%> <%= l(:caption_cost_type) %><%= l(:caption_overall_costs) %>
<%= link_to_remote l(:button_add_material_cost), { :url => { :controller => 'deliverables', :action => 'add_deliverable_costs_row', :project_id => @project }, :method => 'post', :with => "'row_id=' + deliverableCostsRowId", :before => "deliverableCostsRowId++" }, :class => "icon icon-add" %>
<% if User.current.allowed_to?(:view_all_rates, @project) || User.current.allowed_to?(:view_own_rate, @project) %> <% end %> <% @deliverable.deliverable_hours.each do |h| %> <%= render :partial => 'deliverable_hours_row', :locals => {:deliverable_hour => h} %> <% end %> <% if @deliverable_hours_new @deliverable_hours_new.each_with_index do |h, i| %> <%= render :partial => 'deliverable_hours_row', :locals => {:deliverable_hour => h, :row_id => i + 1, :suffix => 'new'} %> <% end end %> <%= render :partial => 'deliverable_hours_row', :locals => {:row_id => deliverable_hours_row_id, :suffix => "new"} %>
<%= l(:field_hours)%> <%= l(:label_user) %><%= l(:caption_overall_costs) %>
<%= link_to_remote l(:button_add_labor_cost), { :url => { :controller => 'deliverables', :action => 'add_deliverable_hours_row', :project_id => @project }, :method => 'post', :with => "'row_id=' + deliverableHoursRowId", :before => "deliverableHoursRowId++" }, :class => "icon icon-add" %>
<%- end %>

<%= f.check_box(:project_manager_signoff) %>

<%= f.check_box(:client_signoff) %>

<%= f.text_field :due_date, :size => 10 %><%= calendar_for('deliverable_due') %>

<%= wikitoolbar_for 'deliverable_description' %>