Rails.application.routes.draw do
  


  get 'logins_list/index'

  get 'logins_list/edit'

  get 'logins_list/show'

  get 'filters/index'

  get 'filters/show'

  get 'filters/new'

  get 'filters/edit'

  namespace :operations do
     get 'perfomance'
     get 'activity'
     get 'map'
     get 'map/period', action: :map_period
     
     get 'prediction'
     
     get 'get_perfomance_data'
     get 'get_activity_hour'
     get 'get_activity_top'
     get 'get_operation_map'
     get 'map/get_oper_map_period_graph', action: :get_oper_map_period_graph
     get 'map/get_oper_map_period_table', action: :get_oper_map_period_table
     get 'get_oper_prediction'
     
     if Rails.env.development?
           get 'set_test_data'
     end
     
  end
  
  namespace :common do
     if Rails.env.development?
          get 'sensor_install'
     end
     get 'index'
     
     
     get 'get_errors_log'
     get 'get_errors_backtrace_log'
     
     get 'operation_sort'
     get 'login_sort'
     get 'office_sort'
     get 'get_index_graph'
  end
  
  namespace :office do
      get 'activity'
      get 'get_office_activity'
      
      get 'list'
      get 'get_office_hour_list'
      get 'get_office_list'
      get 'get_office_list_user_list'
  end
  
  resource :logins do
      get 'perfomance'
      get 'activity'
      get 'map'
      get 'map/period', action: :map_period
      get 'statistic'
      #get 'show'
      
      get 'get_user_perfomance'
      get 'get_user_activity'
      get 'get_user_activity_graph_by_date'
      get 'get_user_activity_office_top10'
      get 'get_user_activity_oper_top10'
      get 'map/get_login_map_period_graph', action: :get_login_map_period_graph
      get 'map/get_login_map_period_table', action: :get_login_map_period_table
      get 'get_user_map'
      get 'get_user_compare_graph'
      get 'get_login_list'
      
  end
  
  namespace :statistic do
      get 'operation'
      get 'day'
      get 'compare'
      get 'export'
      
      get 'get_oper_stat_days'
      get 'get_oper_stat_graph_by_date'
      get 'get_day_stat_activity_by_login'
      get 'get_day_stat_full_activity'
      get 'get_day_compare_for_graph'
      get 'get_day_compare_for_table'
      get 'get_day_compare_stat_for_day'
      get 'stat_export_main'
      
      get 'flextera_log'
      get 'get_flextera_logs'
  end
  
  resource :settings do
      resources :users do
          get 'check_username', on: :collection
      end
      resources :user_groups do
          post 'update_access', on: :member
      end
      resources :filters do
          get 'get_operations_to_filter', on: :collection
          get 'get_logins_to_filter', on: :collection
          get 'get_operations_to_filter', on: :member
          get 'get_logins_to_filter', on: :member
          post 'update_filter', on: :member
      end
      resources :operations_info, only: [:edit,:update]
      resources :logins_info do
         get 'get_login_list', on: :collection 
         get 'get_login_detailed_info', on: :member
      end
      get 'mail'
      get 'mail_send_get_data'
      post 'mail_add_new_rule'
      get 'mail_get_rule_list'
      post 'mail_delete_rule'
      post 'mail_start_server'
      get 'mail_check_server'
      post 'mail_stop_server'
      
      get 'kpi'
      get 'settings_get_kpi_list'
      post 'settings_update_kpi'
      
      get 'logs'
      get 'settings_get_logs'
      
      get 'ad_connections'
      post 'update_ad_settings'
  end
  
  namespace :sessions do
      get 'login'
      get 'ldap_user_auth'
      post 'login_attempt'
      post 'logout'
      post 'change_language'
      post 'update_user_dates'
      post 'update_global_filter'
      
  end
  # The priority is based upon order of creation: first created -> highest priority.
  # See how all your routes lay out with "rake routes".

  # You can have the root of your site routed with "root"
   root 'common#index'

  # Example of regular route:
  #   get 'products/:id' => 'catalog#view'

  # Example of named route that can be invoked with purchase_url(id: product.id)
  #   get 'products/:id/purchase' => 'catalog#purchase', as: :purchase

  # Example resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products

  # Example resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end

  # Example resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end

  # Example resource route with more complex sub-resources:
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', on: :collection
  #     end
  #   end

  # Example resource route with concerns:
  #   concern :toggleable do
  #     post 'toggle'
  #   end
  #   resources :posts, concerns: :toggleable
  #   resources :photos, concerns: :toggleable

  # Example resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end
end
