<%= l(:label_spent_costs) %>

<% labelled_tabular_form_for :cost_entry, @cost_entry, :url => {:action => 'edit', :project_id => @cost_entry.project} do |f| %> <%= error_messages_for 'cost_entry' %> <%= back_url_hidden_field_tag %>

<%= f.text_field :issue_id, :size => 6, :required => true %> <%= h("#{@cost_entry.issue.tracker.name} ##{@cost_entry.issue.id}: #{@cost_entry.issue.subject}") if @cost_entry.issue %>

<%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('cost_entry_spent_on') %>

<% if User.current.allowed_to? :log_costs, @project, :for => nil %>

<%= f.select :user_id, user_collection_for_select_options, :required => true%>

<% end %>

<%= f.select :cost_type_id, cost_types_collection_for_select_options, :required => true %>

<%= f.text_field :units, :size => 6, :required => true %> <%= (@cost_entry.units == 1 ? @cost_entry.cost_type.unit : @cost_entry.cost_type.unit_plural) if @cost_entry.cost_type %> <%= observe_field( "cost_entry_cost_type_id", :url => {:controller => :cost_objects, :action => :update_material_budget_item, :project_id => @cost_entry.project}, :with => "'cost_type_id=' + encodeURIComponent(value) + '&units=' + encodeURIComponent(document.getElementById('cost_entry_units').value) + '&fixed_date=' + encodeURIComponent(document.getElementById('cost_entry_spent_on').value) + '&element_id=cost_entry'") %> <%= observe_field( "cost_entry_units", :frequency => 1, :url => {:controller => :cost_objects, :action => :update_material_budget_item, :project_id => @cost_entry.project}, :with => "'cost_type_id=' + encodeURIComponent(document.getElementById('cost_entry_cost_type_id').value) + '&units=' + encodeURIComponent(value) + '&fixed_date=' + encodeURIComponent(document.getElementById('cost_entry_spent_on').value) + '&element_id=cost_entry'") %> <%= observe_field( "cost_entry_spent_on", :frequency => 1, :url => {:controller => :cost_objects, :action => :update_material_budget_item, :project_id => @cost_entry.project}, :with => "'cost_type_id=' + encodeURIComponent(document.getElementById('cost_entry_cost_type_id').value) + '&units=' + encodeURIComponent(document.getElementById('cost_entry_units').value) + '&fixed_date=' + encodeURIComponent(value) + '&element_id=cost_entry'") %>

<% if User.current.allowed_to? :view_cost_rates, @cost_entry.project %> <%= number_to_currency(@cost_entry.calculated_costs) %> <%= update_page_tag do |page| page << "makeEditable('cost_entry_costs', 'cost_entry[overridden_costs]');" page << "edit($('cost_entry_costs'), 'cost_entry[overridden_costs]', '#{number_to_currency(@cost_entry.overridden_costs)}');" if @cost_entry.overridden_costs end %> <% else %> " size="7" name="cost_entry[overridden_costs]" id="cost_entry_costs_edit"/> <%= Setting.plugin_redmine_costs['costs_currency'] %>
<%= l(:help_override_rate) %> <% end %>

<%= f.text_field :comments, :size => 100 %>

<%= submit_tag l(:button_save) %> <% end %> <% content_for :header_tags do %> <%= javascript_include_tag 'editinplace', :plugin => 'redmine_costs' %> <%= javascript_tag "initialize_editinplace('src=\"#{image_path('cancel.png')}\" value=\"#{l(:label_cancel)}\"' )" %> <%= stylesheet_link_tag 'costs', :plugin => 'redmine_costs' %> <% end %>