233 lines
8.2 KiB
Ruby
233 lines
8.2 KiB
Ruby
ALLOWED_LOCALES = /nl|be|de|fr|en/
|
|
Qwaiter::Application.routes.draw do
|
|
devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" }
|
|
devise_for :suppliers, controllers: { confirmations: 'confirmations', registrations: 'registrations' }
|
|
devise_for :administrators
|
|
namespace :admin do
|
|
resources :users do
|
|
collection do
|
|
get :test_login
|
|
end
|
|
end
|
|
resources :suppliers do
|
|
collection do
|
|
get :test_login
|
|
end
|
|
end
|
|
resources :tables
|
|
resources :orders
|
|
resources :sections
|
|
|
|
resources :user_feedbacks
|
|
|
|
resources :lists
|
|
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
|
|
|
|
|
|
# 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 '/supplier/suppliers/current' => 'supplier#current' #ember
|
|
get '/supplier/suppliers/:id' => 'supplier#current' #ember
|
|
put '/supplier/suppliers/:id' => 'supplier#update' #ember
|
|
|
|
#match '/show_products' => 'dashboard#show_products', as: :user_products
|
|
# GENERAL
|
|
#get '/about' => 'dashboard#about'
|
|
#get '/enquete' => 'dashboard#enquete'
|
|
#get '/cartoon' => 'dashboard#cartoon'
|
|
#get '/bars-restaurants' => 'dashboard#bars_restaurants', as: :bars_restaurants
|
|
#get '/clients' => 'dashboard#clients'
|
|
#get '/contact' => 'dashboard#contact'
|
|
get '/s' => 'dashboard#scan', as: :scan
|
|
|
|
# DEVELOPMENT ONLY
|
|
get '/qr' => 'dashboard#qr'
|
|
get '/demo_both' => 'dashboard#demo_both'
|
|
|
|
# SUPPLIER
|
|
get '/supplier' => 'supplier#home', as: :supplier_root
|
|
get '/supplier/active_orders' => 'supplier#active_orders', as: :supplier_active_orders
|
|
get '/supplier/active_lists' => 'supplier#active_lists', as: :supplier_active_lists
|
|
get '/supplier/menu' => 'supplier#menu', as: :suppliers_menu
|
|
#get '/supplier/lists/:list_id' => 'supplier#show_list', as: :supplier_show_list
|
|
|
|
post '/supplier/close_list' => 'supplier#close_list', as: :supplier_close_list
|
|
post '/supplier/mark_list_as_helped' => 'supplier#mark_list_as_helped', as: :supplier_mark_list_as_helped
|
|
post '/supplier/remove_list_needs_payment' => 'supplier#remove_list_needs_payment', as: :supplier_remove_list_needs_payment
|
|
|
|
post '/supplier/mark_order_in_process' => 'supplier#mark_order_in_process', as: :supplier_mark_order_in_process
|
|
post '/supplier/order_is_delivered' => 'supplier#order_is_delivered', as: :supplier_order_is_delivered
|
|
|
|
post '/supplier/mark_as_open' => 'supplier#mark_as_open', as: :supplier_mark_as_open
|
|
post '/supplier/mark_as_closed' => 'supplier#mark_as_closed', as: :supplier_mark_as_closed
|
|
|
|
get '/supplier/settings' => 'supplier#edit', as: :supplier_settings
|
|
match '/supplier/settings' => 'supplier#update', as: :supplier_update_settings, via: [:put, :post, :patch]
|
|
|
|
namespace :suppliers, path: '/supplier' do
|
|
resources :sections do
|
|
member do
|
|
get :manage_tables
|
|
get :tables_view
|
|
get :table_actions
|
|
post :add_tables
|
|
post :arrange_tables
|
|
end
|
|
end
|
|
resources :tables do
|
|
collection do
|
|
get :qr_codes
|
|
end
|
|
end
|
|
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
|
|
end
|
|
end
|
|
resources :product_categories do
|
|
collection do
|
|
post :sort
|
|
post :import
|
|
end
|
|
end
|
|
resources :orders, only: [:index, :show] do
|
|
member do
|
|
post :cancel
|
|
end
|
|
end
|
|
root to: 'sections#index'
|
|
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'
|
|
#match "/:action", controller: 'dashboard'
|
|
|
|
# The priority is based upon order of creation:
|
|
# first created -> highest priority.
|
|
|
|
# Sample of regular route:
|
|
# match 'products/:id' => 'catalog#view'
|
|
# Keep in mind you can assign values other than :controller and :action
|
|
|
|
# Sample of named route:
|
|
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
|
# This route can be invoked with purchase_url(:id => product.id)
|
|
|
|
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
|
# resources :products
|
|
|
|
# Sample resource route with options:
|
|
# resources :products do
|
|
# member do
|
|
# get 'short'
|
|
# post 'toggle'
|
|
# end
|
|
#
|
|
# collection do
|
|
# get 'sold'
|
|
# end
|
|
# end
|
|
|
|
# Sample resource route with sub-resources:
|
|
# resources :products do
|
|
# resources :comments, :sales
|
|
# resource :seller
|
|
# end
|
|
|
|
# Sample resource route with more complex sub-resources
|
|
# resources :products do
|
|
# resources :comments
|
|
# resources :sales do
|
|
# get 'recent', :on => :collection
|
|
# end
|
|
# end
|
|
|
|
# Sample resource route within a namespace:
|
|
# namespace :admin do
|
|
# # Directs /admin/products/* to Admin::ProductsController
|
|
# # (app/controllers/admin/products_controller.rb)
|
|
# resources :products
|
|
# end
|
|
|
|
# You can have the root of your site routed with "root"
|
|
# just remember to delete public/index.html.
|
|
#
|
|
#root :to => 'dashboard#home'
|
|
root :to => 'pages#home', defaults: {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: 'nl' } do
|
|
get "/:name" => "pages#show", constraints: {name: /.*/}, as: :go_to
|
|
end
|
|
|
|
# See how all your routes lay out with "rake routes"
|
|
|
|
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
|
# Note: This route will make all actions in every controller accessible via GET requests.
|
|
# match ':controller(/:action(/:id))(.:format)'
|
|
end
|