Implement waiter ordering and improvements

This commit is contained in:
2014-03-24 10:02:57 +01:00
parent 474d5f88c6
commit 6c2427e082
24 changed files with 128 additions and 48 deletions
+2 -2
View File
@@ -286,12 +286,12 @@ class UserController < ApplicationController
respond_to do |format|
format.html do
redirect_to(user_root_path, alert: t('messages.cannot_order_on_non_active_list')) and return unless @list.active?
@list.place_order current_user, params[:products]
@list.place_order params[:products], user: current_user
redirect_to user_root_path, notice: t('messages.order_is_placed')
end
format.json do
render json: json_alert('messages.cannot_order_on_non_active_list') and return unless @list.active?
@list.place_order current_user, params[:products]
@list.place_order params[:products], user: current_user
render json: json_notice('messages.order_is_placed', location: :active_list)
end
end
+15
View File
@@ -18,4 +18,19 @@ class WaiterController < ApplicationController
format.json { render json: ProductCategory.all.include_relation(:product), root: 'product_categories', each_serializer: ProductCategorySerializer }
end
end
def order_products
@table= Table.find_by_supplier_id_and_id!(current_supplier.id, params[:table_id])
@list = List.from_table_by_employee(@table, current_employee)
@list.place_order params[:order], employee: current_employee
render nothing: true
end
def current_supplier
@current_supplier ||= Supplier.first
end
def current_employee
@current_employee ||= current_supplier.employees.first
end
end