<% remote_form_for :work, :url => {:action => :update_row, :id => @work.id, :next_field => :customer_name}, :html => {:id => "work_#{@work.id}_form"} do |f|%> <%=f.select :work_account_id, @work_accounts.map {|wa| [wa.name, wa.id]}, {}, :onchange => "form.submit()"%> <% end %> <% remote_form_for :work, :url => {:action => :update_row, :id => @work.id, :next_field => :description} do |f|%> <%=f.select :customer_id, [['', '']] + @customers.map {|cu| [cu.name, cu.id]}, {}, :onchange => "new Ajax.Request('/works/update_row/#{@work.id}?next_field=description', {asynchronous:true, evalScripts:true, parameters:Form.serialize(form)})"%> <% end %> <%=render :partial => 'row_field', :locals => {:field => 'description', :next_field => 'start_time', :next_row_id => next_row_id, :previous_row_id => previous_row_id} %> <%=render :partial => 'row_field', :locals => {:field => 'start_time', :next_field => 'completed_at_time', :next_row_id => next_row_id, :previous_row_id => previous_row_id} %> <%=render :partial => 'row_field', :locals => {:field => 'completed_at_time', :next_field => 'hours_time', :next_row_id => next_row_id, :previous_row_id => previous_row_id} %> <% remote_form_for :work, :url => {:action => :update_row, :id => @work.id, :next_field => :invoice} do |f|%> <%=f.text_field :hours_time, :value => (@work.hours && @work.hours > 0 ? t(@work.hours) : ''), :id => "work_#{@work.id}_hours_time", :class => 'task_hours', :onkeypress => " if(event.keyCode == 40) { e = $('work#{"_#{next_row_id}" if next_row_id}_hours_time'); e.focus(); e.select(); } else if(event.keyCode == 38) { e = $('work#{"_#{previous_row_id}" if previous_row_id}_hours_time'); e.focus(); e.select(); }", :onchange => "new Ajax.Request('/works/update_row/#{@work.id}?next_field=invoice', {asynchronous:true, evalScripts:true, parameters:Form.serialize(form)})"%> <% end %> <% remote_form_for :work, :url => {:action => :update_row, :id => @work.id} do |f|%> <%=f.check_box :invoice, :id => "work_#{@work.id}_invoice", :onchange => "new Ajax.Request('/works/update_row/#{@work.id}?next_field=invoice', {asynchronous:true, evalScripts:true, parameters:Form.serialize(form)})"%> <% end %> <%=image_detour_to('delete.png', l(:delete), {:controller => 'works', :action => :destroy, :id => @work, :confirm => true}, nil, true)%> <% if @work.task %> <%=image_detour_to('task.png', "#{l :task}: #{@work.task.description}", {:controller => 'tasks', :action => :edit, :id => @work.task.id})%> <% end %>