diff --git a/app/assets/javascripts/user/quser.js.coffee b/app/assets/javascripts/user/quser.js.coffee index ef8e3b2a..823803b4 100644 --- a/app/assets/javascripts/user/quser.js.coffee +++ b/app/assets/javascripts/user/quser.js.coffee @@ -238,9 +238,8 @@ class Quser order_selected_products: ()-> return if $.isEmptyObject(window.active_products_list) - return unless Qstorage.table_id h = {} - h['table_id'] = Qstorage.table_id + h['table_id'] = Qstorage.getItem('table_id') if Qstorage.getItem('table_id') for product_id, number of window.active_products_list h['products['+product_id+']'] = number $.post(data_host + '/user/order_selected_products', $.extend(h, authentication_object), ((res) => @handle_response(res)), 'json') diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 367b514a..d3e835e8 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -254,9 +254,10 @@ class UserController < ApplicationController if list.present? @list = list else + render json: js_alert('table_not_found') and return unless params[:table_id].present? @table = Table.find(params[:table_id]) if @table.occupied? - #TODO handle placint order on occupied table + render json: js_alert('table_is_occupied') else if @list = List.from_table( @table, current_user ) else diff --git a/app/views/user/list_products.html.slim b/app/views/user/list_products.html.slim index 7214f311..0fe08708 100644 --- a/app/views/user/list_products.html.slim +++ b/app/views/user/list_products.html.slim @@ -12,9 +12,9 @@ tr td= slider_image #active-order-container -script#products-category-template[type="text/html"]= render 'products_category.mustache' -script#products-category-for-order-template[type="text/html"]= render 'products_category_for_order.mustache' -script#active-order-template[type="text/html"]= render 'active_order.mustache' +script#products-category-template[type="text/html"]= mustache_template 'products_category' +script#products-category-for-order-template[type="text/html"]= mustache_template 'products_category_for_order' +script#active-order-template[type="text/html"]= mustache_template 'active_order' - content_for :footer do javascript: jQuery(function(){