Files
mozo-backend/config/routes.rb
T

192 lines
5.9 KiB
Ruby

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
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'
get '/waiter/*rest' => redirect('/waiter') # Ember app refresh
post '/waiter/order_products' => 'waiter#order_products', as: :order_products_waiter
namespace :waiter do
root to: 'dashboard#index'
end
# USER
#default_url_options format: 'html'
get '/user/index' => 'user#index', as: :user_root
get '/user' => 'user#index'
get '/user/active_list(.:format)' => 'user#active_list', as: :user_active_list
get '/user/list_info' => 'user#list_info', as: :user_list_info, via: [:get, :options]
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'
post '/user/check_table_join_status' => 'user#check_table_join_status'
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' do
resources :product_categories, only: [:index]
resources :lists, only: [:index, :show] do
collection do
get :current
end
end
resources :orders, only: [:create]
resources :tables, only: [:show]
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
get '/supplier' => 'supplier#home', as: :supplier_root
if Rails.env.test? or Rails.env.development?
namespace :tests do
resources :suppliers
resources :lists
end
end
namespace :suppliers, path: '/supplier' do
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
resources :employee_shifts
resources :products do
collection do
get :preview_products
end
end
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
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
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'
# /nl is not matched to pages#home with locale => nl
get '/:locale' => 'pages#home', constraints: {locale: ALLOWED_LOCALES}
#devise_scope :supplier do
#get '/:locale/suppliers/sign_up' => 'registrations#new', constraints: {locale: ALLOWED_LOCALES}
#end
scope '(/:locale)', constraints: {locale: ALLOWED_LOCALES}, defaults: { locale: 'en' } do
root to: 'pages#home'
resources :contact_forms, only: [:create]
resources :new_suppliers
get "/:name" => "pages#show", constraints: {name: /.*/}, as: :go_to
end
end