<% # report = {'name'=> 'Передвижение супервайзеров', 'format'=>'html', 'report_params_attributes'=>[{'name'=>'date', 'view_name'=>'Дата', 'param_type'=> 'date', 'required'=> true},{'name'=>'supervisor', 'view_name'=>'Супервайзер', 'param_type'=> 'supervisors_select', 'required'=> true}]} params = {} params[:q] = {} params[:q][:timestamp_gt] = @params['date'].to_date.beginning_of_day params[:q][:timestamp_lt] = @params['date'].to_date.end_of_day params[:q][:user_supervisor_id_eq] = @params['supervisor'] @errors = [] @search = Location.search(params[:q]) @locations = @search.result.order(:timestamp) @polyline_point = [] @polyline = [] @locations.each do |loc| @polyline_point << {:lat => loc.latitude, :lng => loc.longitude} end @polyline << @polyline_point unless @locations.empty? @markers = Gmaps4rails.build_markers(@locations) do |location, marker| if location == @locations.first marker.lat location.latitude marker.lng location.longitude marker.infowindow render(:partial => "/reports/location", :locals => { :object => location}) marker.picture({:url => '/assets/start.png', :width => 24, :height => 24, :anchor => [12, 24]}) marker.title location.timestamp.to_s elsif location == @locations.last marker.lat location.latitude marker.lng location.longitude marker.infowindow render(:partial => "/reports/location", :locals => { :object => location}) marker.picture({:url => '/assets/finish.png', :width => 24, :height => 24, :anchor => [12, 24]}) marker.title location.timestamp.to_s else marker.lat location.latitude marker.lng location.longitude marker.infowindow render(:partial => "/reports/location", :locals => { :object => location}) marker.picture({:url => '/assets/point.png', :width => 8, :height => 8, :anchor => [4, 4]}) marker.title location.timestamp.to_s end end else error = t('errors.not_found_location') @errors << error end %> <% content_for :javascripts do %> <%= javascript_include_tag 'locations' %> <%= javascript_include_tag 'markerclusterer.min' %> <% end %>

<%= t(:supervisors_movements_report)%>

<% unless @errors.empty? %>

<%=t('errors.title')%>

<% end %> <% if @errors.empty? %>
<% end %>
<%= link_to t(:back), :back, class: 'btn btn-default' %>