ALLOWED_LOCALES = /nl|de|fr|en|es/ Qwaiter::Application.routes.draw do devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" } #devise_for :suppliers, controllers: { confirmations: 'confirmations', registrations: 'registrations' } devise_for :employees, controllers: { #confirmations: 'confirmations', #registrations: 'registrations', sessions: 'suppliers/sessions' } devise_for :administrators namespace :admin do resources :users do collection do get :test_login end end resources :suppliers resources :employees do collection do get :test_login end end resources :tables resources :orders resources :sections resources :user_feedbacks resources :lists resources :svg_elements resources :products resources :product_categories root to: 'users#index' end get 'empty-page' => 'dashboard#empty_page', as: :empty_page post '/user_app' => 'dashboard#user_app_log' #TODO: separate high speed app at log.mozo.bar post '/user_feedback' => 'user#feedback' #WAITER #get '/waiter' => 'waiter#index' #, controller: 'waiter', action: 'index' #get '/waiter/sections' => 'waiter#sections' #get '/waiter/product_categories' => 'waiter#product_categories' post '/waiter/order_products' => 'waiter#order_products', as: :order_products_waiter namespace :waiter do resources :sections resources :suppliers resources :product_categories, only: %i[index] root to: 'dashboard#index' get '/*rest' => redirect('/waiter') # Ember app refresh end # USER #default_url_options format: 'html' #get '/user/index' => 'user#index', as: :user_root #get '/user/index.html#' => 'user#index', as: :user_root #get '/user/active_list(.:format)' => 'user#active_list', as: :user_active_list #post '/user/needs_help' => 'user#needs_help', as: :user_needs_help #post '/user/list_needs_payment' => 'user#list_needs_payment', as: :user_list_needs_payment #post '/user/create_list' => 'user#create_list', as: :user_create_list #get '/user/list_products' => 'user#list_products', as: :user_list_products #get '/user/list_products_for_table' => 'user#list_products_for_table', as: :user_list_products_for_table #get '/user/list_history' => 'user#list_history', as: :user_list_history #get '/user/history_list' => 'user#history_list', as: :user_history_list #post '/user/order_selected_products' => 'user#order_selected_products', as: :user_order_selected_products #post '/user/move_table' => 'user#move_table', as: :user_move_table #get '/user/table_info' => 'user#table_info', as: :user_table_info # get '/user/join_occupied_table' => 'user#join_occupied_table', as: :user_join_occupied_table #post '/user/join_occupied_table' => 'user#request_to_join_occupied_table' #post '/user/reject_join_request' => 'user#reject_join_request' #post '/user/approve_join_request' => 'user#approve_join_request' get '/user/obtain_token' => 'user#obtain_token', as: :user_obtain_token #post '/user/obtain_token' => 'user#obtain_token', constraints: {format: :json} get '/close_window' => 'dashboard#close_window' namespace :users, path: '/user/api/v1' do resources :product_categories, only: [:index] resources :suppliers, only: [:show] resources :lists, only: [:index, :show] do collection do get :current end member do get :table get :orders post :needs_payment post :move_to_table post :order_products post :reject_join_request post :approve_join_request end #resources :orders, only: [:index] end resources :orders, only: [:create] resources :tables do member do post :needs_help post :join post :order_products get :status_info get :supplier end end end get '/s' => 'dashboard#scan', as: :scan # DEVELOPMENT ONLY get '/qr' => 'dashboard#qr' get '/demo-both' => 'dashboard#demo_both' get :tests, to: 'test_squad#tests' unless Rails.env.production? # SUPPLIER if Rails.env.test? or Rails.env.development? namespace :tests do resources :suppliers resources :lists end end namespace :suppliers, path: '/supplier/api/v1' do get 'employee_and_supplier', controller: 'application' resources :suppliers do member do get :switch_to post :mark_as_open post :mark_as_closed end end resources :sections do member do get :manage_tables get :tables_view get :table_actions post :add_tables post :arrange_tables end end resources :svg_elements, only: [:index, :show] resources :section_elements resources :section_areas resources :tables do collection do get :qr_codes end end resources :employees do get :suppliers, on: :member end resources :employee_shifts resources :products do collection do get :preview_products end end resources :product_variants resources :lists do collection do get :active get :at_date end member do get :extra_info post :mark_helped post :close post :remove_needs_payment post :change_table end end resources :product_categories do collection do post :sort post :import end end resources :orders, only: [:index, :show] do member do post :cancel post :mark_in_process post :mark_delivered end end resources :pages, only: [:index, :show], constraints: {id: /.*/} root to: 'sections#index' end namespace :employees, path: '/employee' do resources :suppliers resources :employee_shifts end #DEMO & DEVELOPMENT get '/select_qrcode' => 'dashboard#select_qrcode' get '/table_qr_image' => 'dashboard#table_qr_image', as: :table_qr_image mount Cmtool::Engine => '/cmtool' # NOTE: tried to do the following 2 matchers in 1 like get '/supplier*other', but did not work, so better safe then sorry and use 2 get '/supplier' => 'supplier#home', as: :supplier_root get '/supplier/*other' => 'supplier#home' # /nl is not matched to pages#home with locale => nl get '/:locale' => 'pages#home', constraints: {locale: ALLOWED_LOCALES}, as: :go_to_locale get '/sitemap(.:format)' => 'pages#sitemap' #devise_scope :supplier do #get '/:locale/suppliers/sign_up' => 'registrations#new', constraints: {locale: ALLOWED_LOCALES} #end scope '(/:locale)', constraints: {locale: ALLOWED_LOCALES}, defaults: { locale: Rails.application.config.i18n.default_locale.to_s } do root to: 'pages#home' resources :contact_forms, only: [:create] resources :new_suppliers get "/:name" => "pages#show", constraints: {name: /.*/}, as: :page end end