diff --git a/README.md b/README.md index ce5402ac..25086cce 100755 --- a/README.md +++ b/README.md @@ -183,6 +183,9 @@ For MoveTablePdf in print settings /* Tax Profile Group Types in lookups */ >>>>>>> 1c13b0469758fb968c0dfcc1f0a876ed2c5e395a +Add Kitchen Role of Employee + => 1) settings/lookups => { type:employee_roles, name: Kitchen, value:kitchen } + * ToDo list 1. Migration diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index e49f7446..30ed8af2 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -266,11 +266,22 @@ $(function() { $('.set_order').attr('data-min-qty',item_sets[field]["min_selectable_qty"]); value = item_sets[field]["instances"]; - $(value).each(function(i){ + if (type != -1 && modify_order != -1) { + url = '../../../../api/restaurant/menu_item_instances/'+value[i]["id"]; + console.log("ssssssss") + } + if(modify_order == -1 && type != -1){ + url = '../../api/restaurant/menu_item_instances/'+value[i]["id"] ; + console.log("aaaaaa") + } + if (type ==-1 && modify_order == -1){ + url = '../../api/restaurant/menu_item_instances/'+value[i]["id"]; + console.log("cccccccccc") + } $.ajax({ type: "GET", - url: '../../api/restaurant/menu_item_instances/'+value[i]["id"], + url: url, data: {id:value[i]}, success:function(result){ @@ -370,7 +381,7 @@ $(function() { // $(this).removeAttr('data-options'); // $('#instance_option').text('') // }else { - if (rowCount.length+1 <= max_qty) { + if (setCount.length+1 <= max_qty) { sub_total = $('#set_total_price').text(); name = $(this).data('name'); price = $(this).data('price'); @@ -1317,9 +1328,18 @@ console.log(d_option) } function customer_display_view(data,status) { + if (type != -1 && modify_order != -1) { + url = '../../../../origami/customer_view'; + } + if(modify_order == -1 && type != -1){ + url = '../../origami/customer_view'; + } + if (type ==-1 && modify_order == -1){ + url = '../../origami/customer_view'; + } $.ajax({ type: "POST", - url: '../../origami/customer_view', + url: url, data: {"data":data,"status":status}, dataType: "json", success:function(result){ diff --git a/app/controllers/api/restaurant/item_sets_controller.rb b/app/controllers/api/restaurant/item_sets_controller.rb index a7ad9efc..99581550 100755 --- a/app/controllers/api/restaurant/item_sets_controller.rb +++ b/app/controllers/api/restaurant/item_sets_controller.rb @@ -1,5 +1,4 @@ class Api::Restaurant::ItemSetsController < Api::ApiController - #Description # Pull the default menu details and also other available (active) menus # Input Params - order_id diff --git a/app/controllers/api/restaurant/menu_categories_controller.rb b/app/controllers/api/restaurant/menu_categories_controller.rb index f1f3e6d0..644a38a8 100755 --- a/app/controllers/api/restaurant/menu_categories_controller.rb +++ b/app/controllers/api/restaurant/menu_categories_controller.rb @@ -1,5 +1,4 @@ -class Api::Restaurant::MenuCategoriesController < Api::ApiController - skip_before_action :authenticate +class Api::Restaurant::MenuCategoriesController < Api::ApiController #Description # Pull the default menu details and also other available (active) menus # Input Params - order_id diff --git a/app/controllers/api/restaurant/menu_controller.rb b/app/controllers/api/restaurant/menu_controller.rb index ad8ad7f9..96ba3cc0 100755 --- a/app/controllers/api/restaurant/menu_controller.rb +++ b/app/controllers/api/restaurant/menu_controller.rb @@ -1,5 +1,4 @@ class Api::Restaurant::MenuController < Api::ApiController - skip_before_action :authenticate #Description # Pull the default menu details and also other available (active) menus # Input Params - order_id diff --git a/app/controllers/api/restaurant/menu_item_attributes_controller.rb b/app/controllers/api/restaurant/menu_item_attributes_controller.rb index 37719c37..d0469924 100755 --- a/app/controllers/api/restaurant/menu_item_attributes_controller.rb +++ b/app/controllers/api/restaurant/menu_item_attributes_controller.rb @@ -1,5 +1,4 @@ -class Api::Restaurant::MenuItemAttributesController < Api::ApiController - skip_before_action :authenticate +class Api::Restaurant::MenuItemAttributesController < Api::ApiController #Description # Pull the default menu details and also other available (active) menus # Input Params - order_id diff --git a/app/controllers/api/restaurant/menu_item_instances_controller.rb b/app/controllers/api/restaurant/menu_item_instances_controller.rb index be38f782..cfe75b19 100755 --- a/app/controllers/api/restaurant/menu_item_instances_controller.rb +++ b/app/controllers/api/restaurant/menu_item_instances_controller.rb @@ -1,5 +1,4 @@ -class Api::Restaurant::MenuItemInstancesController < Api::ApiController - skip_before_action :authenticate +class Api::Restaurant::MenuItemInstancesController < Api::ApiController #Description # Pull the default menu details and also other available (active) menus # Input Params - order_id diff --git a/app/controllers/base_origami_controller.rb b/app/controllers/base_origami_controller.rb index 86fb4ec3..66cc2880 100755 --- a/app/controllers/base_origami_controller.rb +++ b/app/controllers/base_origami_controller.rb @@ -15,19 +15,16 @@ class BaseOrigamiController < ActionController::Base redirect_to origami_dashboard_path end - def check_user - token_status = false - authenticate_with_http_token do |token, options| - if token - token_status = true - session[:webview] = true - session[:session_token] = token - end - end - - if !token_status + def check_user + if check_mobile if current_user.nil? - redirect_to root_path + return render status: 401, json: { + message: "User using other device!" + }.to_json + end + else + if current_user.nil? + redirect_to root_path end end end @@ -49,9 +46,13 @@ class BaseOrigamiController < ActionController::Base #check webview def check_mobile status = false - puts "check mobile" - puts session[:session_token] - puts session[:webview] + authenticate_with_http_token do |token, options| + if token + session[:webview] = true + session[:session_token] = token + end + end + if session[:webview] && request.user_agent =~ /android|blackberry|iphone|ipad|ipod|iemobile|mobile|webos/i status = true end diff --git a/app/controllers/concerns/token_verification.rb b/app/controllers/concerns/token_verification.rb index 66658b6a..1d700c8b 100755 --- a/app/controllers/concerns/token_verification.rb +++ b/app/controllers/concerns/token_verification.rb @@ -9,7 +9,7 @@ module TokenVerification protected # Authenticate the user with token based authentication - def authenticate + def authenticate authenticate_token || render_unauthorized end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index d2b0ad36..e720444f 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -70,6 +70,9 @@ class HomeController < ApplicationController elsif @employee.role == "account" session[:session_token] = @employee.token_session redirect_to reports_dailysale_index_path + elsif @employee.role == "kitchen" + session[:session_token] = @employee.token_session + redirect_to oqs_root_path else render :index end diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb index 049bbda6..4bc99f59 100644 --- a/app/controllers/oqs/edit_controller.rb +++ b/app/controllers/oqs/edit_controller.rb @@ -1,4 +1,5 @@ class Oqs::EditController < BaseOqsController + authorize_resource :class => false def index assigned_item_id = params[:id] @link_type = params[:type] diff --git a/app/controllers/oqs/home_controller.rb b/app/controllers/oqs/home_controller.rb index 19d4c17f..23d6341e 100755 --- a/app/controllers/oqs/home_controller.rb +++ b/app/controllers/oqs/home_controller.rb @@ -1,8 +1,6 @@ class Oqs::HomeController < BaseOqsController + authorize_resource :class => false def index - - - # Query for OQS with delivery status false # @queue_items_details = queue_items_query(false) diff --git a/app/controllers/oqs/print_controller.rb b/app/controllers/oqs/print_controller.rb index 930d3d5c..bf5b803a 100755 --- a/app/controllers/oqs/print_controller.rb +++ b/app/controllers/oqs/print_controller.rb @@ -1,4 +1,5 @@ class Oqs::PrintController < ApplicationController + authorize_resource :class => false # Print Order Item def print if ENV["SERVER_MODE"] != "cloud" #no print in cloud server diff --git a/app/models/ability.rb b/app/models/ability.rb index b1930e1b..e9509289 100755 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -98,6 +98,22 @@ class Ability can :create, :split_bill can :update_sale, :split_bill + #oqs Home + can :index, :home + can :index, :show + can :get_order_items, :home + can :get_items_by_oqs, :home + can :update_delivery_status, :home + can :queue_items_query, :home + can :completed_order, :home + can :queue_items_count_query, :home + + can :index, :edit + can :update, :edit + + can :print, :print + can :print_order_summary, :print + elsif user.role == "cashier" # can :overall_void, :void @@ -144,6 +160,22 @@ class Ability can :index, :split_bill can :create, :split_bill can :update_sale, :split_bill + + #oqs Home + can :index, :home + can :index, :show + can :get_order_items, :home + can :get_items_by_oqs, :home + can :update_delivery_status, :home + can :queue_items_query, :home + can :completed_order, :home + can :queue_items_count_query, :home + + can :index, :edit + can :update, :edit + + can :print, :print + can :print_order_summary, :print elsif user.role == "account" @@ -206,6 +238,23 @@ class Ability can :index, :split_bill can :create, :split_bill can :update_sale, :split_bill + + #oqs Home + can :index, :home + can :index, :show + can :get_order_items, :home + can :get_items_by_oqs, :home + can :update_delivery_status, :home + can :queue_items_query, :home + can :completed_order, :home + can :queue_items_count_query, :home + + can :index, :edit + can :update, :edit + + can :print, :print + can :print_order_summary, :print + elsif user.role == "waiter" can :index, :home can :show, :home @@ -232,6 +281,40 @@ class Ability #ability for split_bill can :index, :split_bill can :create, :split_bill + + #oqs Home + can :index, :home + can :index, :show + can :get_order_items, :home + can :get_items_by_oqs, :home + can :update_delivery_status, :home + can :queue_items_query, :home + can :completed_order, :home + can :queue_items_count_query, :home + + can :index, :edit + can :update, :edit + + can :print, :print + can :print_order_summary, :print + + elsif user.role == "kitchen" + + #oqs Home + can :index, :home + can :index, :show + can :get_order_items, :home + can :get_items_by_oqs, :home + can :update_delivery_status, :home + can :queue_items_query, :home + can :completed_order, :home + can :queue_items_count_query, :home + + can :index, :edit + can :update, :edit + + can :print, :print + can :print_order_summary, :print end end end diff --git a/app/views/origami/dashboard/index.html.erb b/app/views/origami/dashboard/index.html.erb index 2d7657f5..68b09437 100644 --- a/app/views/origami/dashboard/index.html.erb +++ b/app/views/origami/dashboard/index.html.erb @@ -193,8 +193,6 @@