%#-- copyright
OpenProject Costs Plugin
Copyright (C) 2009 - 2014 the OpenProject Foundation (OPF)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 3.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
++#%>
<%= f.hidden_field :kind %>
<%= f.text_field :subject, :size => 80, :required => true %>
<%= f.text_area :description,
:cols => 60,
:rows => (@cost_object.description.blank? ? 10 : [[10, @cost_object.description.length / 50].max, 100].min),
:class => 'wiki-edit' %>
<%= f.text_field :fixed_date, :size => 10 %><%= calendar_for('cost_object_fixed_date') %>
<% if @cost_object.kind == "VariableCostObject" -%>
<%= VariableCostObject.human_attribute_name(:material_budget) %>
<%= MaterialBudgetItem.human_attribute_name(:units) %>
<%= MaterialBudgetItem.human_attribute_name(:cost_type) %>
<%= MaterialBudgetItem.human_attribute_name(:comment) %>
<% if User.current.allowed_to?(:view_cost_rates, @project)%><%= MaterialBudgetItem.human_attribute_name(:budget) %> <%end%>
<%- @cost_object.material_budget_items.each_with_index do |material_budget_item, index| -%>
<%= render :partial => 'material_budget_item', :object => material_budget_item, :locals => {:index => index, :classes => cycle('odd', 'even')} %>
<%- end -%>
<%= link_to_function l(:button_add_budget_item), "materialBudgetItemsForm.add()", {:class => "icon-context icon-add"} %>
<%= VariableCostObject.human_attribute_name(:labor_budget) %>
<%= LaborBudgetItem.human_attribute_name(:hours) %>
<%= LaborBudgetItem.human_attribute_name(:user) %>
<%= LaborBudgetItem.human_attribute_name(:comment) %>
<% if User.current.allowed_to?(:view_hourly_rates, @project) %>
<%= LaborBudgetItem.human_attribute_name(:budget) %>
<% end %>
<%- @cost_object.labor_budget_items.each_with_index do |labor_budget_item, index| -%>
<%= render :partial => 'labor_budget_item', :object => labor_budget_item, :locals => {:index => index, :classes => cycle('odd', 'even')} %>
<%- end -%>
<%= link_to_function l(:button_add_budget_item), "laborBudgetItemsForm.add()", {:class => "icon-context icon-add"} %>
<%- end %>
<% if @cost_object.new_record? %>
<%=l(:label_attachment_plural)%> <%= render :partial => 'attachments/form' %>
<% end %>
<%= wikitoolbar_for 'cost_object_description' %>
<% content_for :header_tags do %>
<%= javascript_tag "initialize_editinplace('src=\"#{asset_path('webalys/cancel.png')}\" alt=\"#{l(:button_cancel_edit_budget)}\" title=\"#{l(:button_cancel_edit_budget)}\"' )" %>
<% end %>