<% shift = @shifts.select{|i| i.shift_date == day}.sort_by{|i| i.employee_nic.downcase.to_s}%>
<% employee_working_without_shift = @employee_working_without_shifts.select{|i| i.shift_date.to_date == day} %>
<%= link_to_remote (day.day.to_s + "
" + ManagerShift.for_department(@department).for_date(day).map{|i| i.employee_nic}.join(', ')), :url => edit_work_shift_path(:id => 1, :date => day.to_s, :view_type => @view_type, :empl_id => params[:empl_id]), :method => :get %>
<% for time in [10, 11, 12, 14, 16, 18, 19, 20, 21] do %>
<%= time %>
<%= shift.select{|i| i.time_from.hour <= time && i.time_to.hour >= time if i.time_from && i.time_to}.count %>
<% end %>
<% for de in shift do %>
<% works_count = (c=@reports.select{|i| i.employee_id.to_i == de.employee_id && i.shift_date.to_date == de.shift_date}).size > 0 ? c.first.works_count : 0%>
<% work_class = ""; work_class += " color:red" if works_count == 0;%>
- <%= link_to_remote de.employee_nic, :url => edit_person_work_shift_path(:id => de.employee_id, :date => day, :view_type => @view_type, :empl_id => params[:empl_id]), :method => :get, :html =>{:class => "plain"} %> - <%= works_count if @view_type.to_i == 1%> <%= de.work_time if @view_type.to_i == 0%>
<% end %>
<% for empl in employee_working_without_shift do %>
- <%= link_to_remote empl.employee_nic, :url => edit_person_work_shift_path(:id => empl.employee_id, :date => day, :view_type => @view_type, :empl_id => params[:empl_id]), :method => :get, :html =>{:class => "plain"} %> - <%= empl.works_count if @view_type.to_i == 1%> <%= "выходной" if @view_type.to_i == 0 %>
<% end -%>