<%= 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| %> "> <% if User.current.allowed_to?(:view_unit_price, @project)%><% end %> <% end %> <%= render :partial => 'deliverable_costs_row', :locals => {:row_id => 1} %>
<%= l(:caption_cost_unit_plural)%> <%= l(:caption_cost_type) %><%= l(:caption_overall_costs) %>
<%= text_field c, :units, :value => c.units, :size => 3, :id => "deliverable_costs_#{c.id}_units", :name => "deliverable_costs[#{c.id}][units]" %> "><%=h c.units.to_s == '1.0' ? c.cost_type.unit : c.cost_type.unit_plural %> <%= select c.cost_type, :id, cost_types_collection_for_select_options, {}, :name => "deliverable_costs[#{c.id}][cost_type_id]", :id => "deliverable_costs_#{c.id}_cost_type_id" %> <%= observe_field( "deliverable_costs_#{c.id}_cost_type_id", :url => {:action => :update_deliverable_costs_row}, :with => "'cost_type_id=' + encodeURIComponent(value) + '&units=' + encodeURIComponent(document.getElementById('deliverable_costs_#{c.id}_units').value) + '&element_id=deliverable_costs_#{c.id}'") %> "><%= number_to_currency(c.costs) if c.costs > 0 %> <%= observe_field( "deliverable_costs_#{c.id}_units", :frequency => 1, :url => {:action => :update_deliverable_costs_row}, :with => "'cost_type_id=' + encodeURIComponent(document.getElementById('deliverable_costs_#{c.id}_cost_type_id').value) + '&units=' + encodeURIComponent(value) + '&element_id=deliverable_costs_#{c.id}'") %> <%= image_to_function 'delete.png', "deleteDeliverableCostsEntry('deliverable_costs_#{c.id}')" %>
<%= link_to_remote l(:button_add_material_cost), { :url => { :controller => 'deliverables', :action => 'add_deliverable_costs_row', :project_id => @project }, :method => 'post', :with => "'row_id=' + deliverableCostsNextRow", :before => "deliverableCostsNextRow++" }, :class => "icon icon-add" %>
<% if User.current.allowed_to?(:view_all_rates, @project) || (user == User.current && User.current.allowed_to?(:view_own_rate, @project)) %> <% end %> <% @deliverable.deliverable_hours.each do |c| %> "> <% if User.current.allowed_to?(:view_unit_price, @project)%><% end %> <% end %> <%= render :partial => 'deliverable_hours_row', :locals => {:row_id => 1} %>
<%= l(:field_hours)%> <%= l(:label_user) %><%= l(:caption_overall_costs) %>
<%= text_field c, :units, :value => c.hours, :size => 3, :id => "deliverable_hours_#{c.id}_hours", :name => "deliverable_hours[#{c.id}][hours]" %> <%= select c.user, :id, user_collection_for_select_options (:generic_user => true), {}, :name => "deliverable_hours[#{c.id}][user_id]", :id => "deliverable_hours_#{c.id}_user_id" %> <%= observe_field( "deliverable_hours_#{c.id}_cost_type_id", :url => {:action => :update_deliverable_hours_row}, :with => "'user_id=' + encodeURIComponent(value) + '&hours=' + encodeURIComponent(document.getElementById('deliverable_hours_#{c.id}_hours').value) + '&element_id=deliverable_hours_#{c.id}'") %> "><%= number_to_currency(c.costs) if c.costs > 0 %> <%= observe_field( "deliverable_hours_#{c.id}_hours", :frequency => 1, :url => {:action => :update_deliverable_hours_row}, :with => "'user_id=' + encodeURIComponent(document.getElementById('deliverable_hours_#{c.id}_user_id').value) + '&hours=' + encodeURIComponent(value) + '&element_id=deliverable_hours_#{c.id}'") %> <%= image_to_function 'delete.png', "deleteDeliverableHoursEntry('deliverable_hours_#{c.id}')" %>
<%= link_to_remote l(:button_add_labor_cost), { :url => { :controller => 'deliverables', :action => 'add_deliverable_hours_row', :project_id => @project }, :method => 'post', :with => "'row_id=' + deliverableHoursNextRow", :before => "deliverableHoursNextRow++" }, :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' %>