<% form_remote_tag :url => '/work_shifts/update', :html =>{:class => "formtastic", :id=> "edit_shifts"} do -%> <%= hidden_field_tag :view_type, @view_type%> <%= hidden_field_tag :empl_id, params[:empl_id]%> <%= hidden_field_tag :date, @date%> <%= hidden_field_tag :regular, :id => "regular" %>

<%= link_to_remote "<", :url => edit_work_shift_path((@date - 1.day), :view_type => @view_type), :method => :get, :html =>{:style =>"text-decoration:none;"} %> Смены за <%= Russian::strftime(@date) %> (<%=Russian::strftime(@date, "%A") %>) <%= link_to_remote ">", :url => edit_work_shift_path((@date + 1.day), :view_type => @view_type), :method => :get, :html =>{:style =>"text-decoration:none;"} %>

<% @employees.each do |person| %> <% fields_for "employees[#{person.id}]", person do |c| -%> <% (dm = @shifts.select{|i| i.employee == person}.first).nil? ? dm=person.work_shifts.build(:department => @department, :shift_date => @date) : dm%> <% c.fields_for :work_shifts, dm do |e| -%> <% end %> <% end %> <% end %>
СотрудникКол-во отчетов
<%= e.hidden_field :_destroy, :class => "del" %> <%= e.check_box :checked_m, :class => 'people', :id => person.id.to_s+'e', :onchange => "check_del_attr($(this))"%>
<%= (rs=@reports.select{|i| i.id.to_i == person.id}).size >0 ? rs.first.works_count : 0%> <%= e.hidden_field :employee_id %> <%= e.hidden_field :shift_date, :id => person.id.to_s+"i" %> <%= e.hidden_field :department %> <%= e.hidden_field :id %>
<%= submit_tag "Сохранить" , :id => "save", :onclick => "if($('.formtastic').valid() == false){ return false; event.returnValue = false}" %> <%#= submit_tag "Сохранить как регулярное" , :onclick => "$('#regular').val('1'); if($('.formtastic').valid() == false){ return false}" %> <%= button_to_function "Отмена", "$('#window2').hide()"%>
<% end %>