OpenProject is the leading open source project management software.
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.
 
 
 
 
 
 
openproject/app/views/deliverables/_deliverable_hour.rhtml

32 lines
2.1 KiB

<%-
index ||= "INDEX"
new_or_existing = deliverable_hour.new_record? ? 'new' : 'existing'
id_or_index = deliverable_hour.new_record? ? index : deliverable_hour.id
prefix = "deliverable[#{new_or_existing}_deliverable_hour_attributes][]"
id_prefix = "deliverable_#{new_or_existing}_deliverable_hour_attributes_#{id_or_index}"
@deliverable_hour = deliverable_hour
error_messages = error_messages_for 'deliverable_hour'
-%>
<%if error_messages %><tr><td colspan="4"><%= error_messages %></td></tr><% end %>
<tr class="cost-entry" id="<%= id_prefix %>">
<% fields_for prefix, deliverable_hour do |cost_form| %>
<td class="cost_units">
<%= cost_form.text_field :hours, :index => id_or_index, :size => 3 %>
</td>
<td>
<%= cost_form.select :user_id, @project.assignable_users.sort.select{|u| u.rate_at(@deliverable.fixed_date, @project)}.collect{|u| [u.name, u.id]}, {:prompt => true}, {:index => id_or_index} %>
</td>
<% if User.current.allowed_to?(:view_all_rates, @project) || User.current.allowed_to?(:view_own_rate, @project) %>
<td class="currency">
<span id="<%= "#{id_prefix}_costs" %>"><%= number_to_currency(deliverable_hour.costs) if deliverable_hour.can_view_costs?(User.current, @project) %></span>
<%= observe_field( "#{id_prefix}_user_id", :url => {:action => :update_deliverable_hour}, :with => "'user_id=' + encodeURIComponent(value) + '&hours=' + encodeURIComponent(document.getElementById('#{id_prefix}_hours').value) + '&fixed_date=' + encodeURIComponent(document.getElementById('deliverable_fixed_date').value) + '&element_id=#{id_prefix}'") %>
<%= observe_field( "#{id_prefix}_hours", :frequency => 1, :url => {:action => :update_deliverable_hour}, :with => "'user_id=' + encodeURIComponent(document.getElementById('#{id_prefix}_user_id').value) + '&hours=' + encodeURIComponent(value) + '&fixed_date=' + encodeURIComponent(document.getElementById('deliverable_fixed_date').value) + '&element_id=#{id_prefix}'") %>
</td>
<% end %>
<td align="center">
<%= image_to_function 'delete.png', "deleteDeliverableHour('#{id_prefix}')" %>
</td>
<% end %>
</tr>