kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
3.9 KiB
67 lines
3.9 KiB
<%#-- 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.
|
|
|
|
++#%>
|
|
|
|
<%-
|
|
index ||= "INDEX"
|
|
new_or_existing = material_budget_item.new_record? ? 'new' : 'existing'
|
|
id_or_index = material_budget_item.new_record? ? index : material_budget_item.id
|
|
prefix = "cost_object[#{new_or_existing}_material_budget_item_attributes][]"
|
|
id_prefix = "cost_object_#{new_or_existing}_material_budget_item_attributes_#{id_or_index}"
|
|
name_prefix = "cost_object[#{new_or_existing}_material_budget_item_attributes][#{id_or_index}]"
|
|
classes ||= ""
|
|
|
|
@material_budget_item = material_budget_item
|
|
error_messages = error_messages_for 'material_budget_item'
|
|
-%>
|
|
|
|
<% unless error_messages.blank? %><tr><td colspan="5"><%= error_messages %></td></tr><% end %>
|
|
<%= fields_for prefix, material_budget_item do |cost_form| %>
|
|
<tr class="cost_entry <%= classes %>" id="<%= id_prefix %>">
|
|
<td class="units">
|
|
<label class="hidden-for-sighted" for="<%= id_prefix %>_units"><%= MaterialBudgetItem.human_attribute_name(:units) %></label>
|
|
<%= cost_form.text_field :units, :index => id_or_index, :size => 3 %>
|
|
<span id="<%= "#{id_prefix}_unit_name" %>">
|
|
<%=h material_budget_item.cost_type.unit_plural if material_budget_item.cost_type %>
|
|
</span>
|
|
</td>
|
|
<td class="cost_type">
|
|
<label class="hidden-for-sighted" for="<%= id_prefix %>_cost_type_id"><%= MaterialBudgetItem.human_attribute_name(:cost_type) %></label>
|
|
<%= cost_form.select :cost_type_id, cost_types_collection_for_select_options(material_budget_item.cost_type), {}, {:index => id_or_index} %>
|
|
<%= observe_field( "#{id_prefix}_cost_type_id", :url => {:action => :update_material_budget_item, :project_id => @project.id}, :with => "'cost_type_id=' + encodeURIComponent(value) + '&units=' + encodeURIComponent(document.getElementById('#{id_prefix}_units').value) + '&fixed_date=' + encodeURIComponent(document.getElementById('cost_object_fixed_date').value) + '&element_id=#{id_prefix}'") %>
|
|
<%= observe_field( "#{id_prefix}_units", :frequency => 1, :url => {:action => :update_material_budget_item, :project_id => @project.id}, :with => "'cost_type_id=' + encodeURIComponent(document.getElementById('#{id_prefix}_cost_type_id').value) + '&units=' + encodeURIComponent(value) + '&fixed_date=' + encodeURIComponent(document.getElementById('cost_object_fixed_date').value) + '&element_id=#{id_prefix}'") %>
|
|
</td>
|
|
<td class="comment">
|
|
<label class="hidden-for-sighted" for="<%= id_prefix %>_comments"><%= MaterialBudgetItem.human_attribute_name(:comments) %></label>
|
|
<%= cost_form.text_field :comments, :index => id_or_index, :size => 40 %>
|
|
</td>
|
|
<td class="currency">
|
|
<a href="javascript:;" id="<%= "#{id_prefix}_costs" %>" class="icon-context icon-edit" title="<%= l(:help_click_to_edit) %>">
|
|
<%= number_to_currency(material_budget_item.calculated_costs(@cost_object.fixed_date)) %>
|
|
</a>
|
|
<%= update_page_tag do |page|
|
|
page << "makeEditable('#{id_prefix}_costs', '#{name_prefix}[budget]');"
|
|
page << "edit($('#{id_prefix}_costs'), '#{name_prefix}[budget]', '#{number_to_currency(material_budget_item.budget)}');" if material_budget_item.budget
|
|
end %>
|
|
</td>
|
|
<td class="delete">
|
|
<%= link_to_function icon_wrapper('icon-context icon-delete',t(:button_delete)), "deleteMaterialBudgetItem('#{id_prefix}')", :class => 'no-decoration-on-hover', :title => t(:button_delete) %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
|