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_hours_row.rhtml

29 lines
2.2 KiB

<%
suffix = suffix ? "_#{suffix}" : ""
deliverable_hour = nil unless defined?(deliverable_hour)
row_id = deliverable_hour.id unless row_id || !defined?(deliverable_hour)
%>
<tr class="cost-entry" id="<%= "deliverable_hours#{suffix}_#{row_id}" %>">
<td class="cost_units">
<% if deliverable_hour %>
<%= text_field deliverable_hour, :hours, :value => deliverable_hour.hours, :size => 3, :id => "deliverable_hours#{suffix}_#{row_id}_hours", :name => "deliverable_hours#{suffix}[#{row_id}][hours]" %>
<% else %>
<%= text_field_tag "deliverable_hours#{suffix}[#{row_id}][hours]", nil, :size => 3, :id => "deliverable_hours#{suffix}_#{row_id}_hours" %>
<% end %>
</td>
<td>
<% if deliverable_hour %>
<%= select "deliverable_hours#{suffix}[#{row_id}]", :user_id, user_collection_for_select_options(:generic_user => true), {:object => deliverable_hour.rate} %>
<%- else -%>
<%= select "deliverable_hours#{suffix}[#{row_id}]", :user_id, user_collection_for_select_options(:generic_user => true) %>
<%- end %>
<%= observe_field( "deliverable_hours#{suffix}_#{row_id}_user_id", :url => {:action => :update_deliverable_hours_row}, :with => "'user_id=' + encodeURIComponent(value) + '&hours=' + encodeURIComponent(document.getElementById('deliverable_hours#{suffix}_#{row_id}_hours').value) + '&element_id=deliverable_hours#{suffix}_#{row_id}'") %>
</td>
<% if User.current.allowed_to?(:view_all_rates, @project) || User.current.allowed_to?(:view_own_rate, @project) %><td class="currency">
<span id="<%= "deliverable_hours#{suffix}_#{row_id}_costs" %>"><%= number_to_currency(deliverable_hour.costs) if deliverable_hour && deliverable_hour.can_view_costs?(User.current, @project) %></span>
<%= observe_field( "deliverable_hours#{suffix}_#{row_id}_hours", :frequency => 1, :url => {:action => :update_deliverable_hours_row}, :with => "'user_id=' + encodeURIComponent(document.getElementById('deliverable_hours#{suffix}_#{row_id}_user_id').value) + '&hours=' + encodeURIComponent(value) + '&element_id=deliverable_hours#{suffix}_#{row_id}'") %>
</td><% end %>
<td align="center">
<%= image_to_function 'delete.png', "deleteDeliverableHoursEntry('deliverable_hours#{suffix}_#{row_id}')" %>
</td>
</tr>