diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 69ac19d4..f6b702f7 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -985,19 +985,19 @@ $(function() { $("#back").on("click", function(){ var table_id = $('#table_id').text(); var table_type = $('#table_type').text(); - type = window.location.href.indexOf("quick_service"); - if (type == 'true') { + type = window.location.href.includes("quick_service"); + if (type == true) { var table_type = $('#table_id').find("option:selected").data('type'); var table_id = $('#table_id').val(); - window.location.href = "/origami/dashboard" + window.location.href = "/origami/dashboard"; }else{ var table_type = $('#table_type').text(); var table_id = $('#table_id').text(); if(table_type == "Table"){ - window.location.href = "/origami/table/" + table_id + window.location.href = "/origami/table/" + table_id; }else { - window.location.href = "/origami/room/" + table_id + window.location.href = "/origami/room/" + table_id; } } }); diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 940f6103..3ebafa99 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -90,13 +90,15 @@ class HomeController < ApplicationController @sale_data = Array.new @total_payment_methods = Sale.total_payment_methods(today,current_user,@from,@to) - @total_payment_methods.each do |payment| - if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb" - pay = Sale.payment_sale('card', today, current_user,@from,@to) - @sale_data.push({'card' => pay.payment_amount}) - else - pay = Sale.payment_sale(payment.payment_method, today, current_user,@from,@to) - @sale_data.push({payment.payment_method => pay.payment_amount}) + if !@total_payment_methods.nil? + @total_payment_methods.each do |payment| + if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb" + pay = Sale.payment_sale('card', today, current_user,@from,@to) + @sale_data.push({'card' => pay.payment_amount}) + else + pay = Sale.payment_sale(payment.payment_method, today, current_user,@from,@to) + @sale_data.push({payment.payment_method => pay.payment_amount}) + end end end @summ_sale = Sale.summary_sale_receipt(today,current_user,@from,@to) @@ -109,10 +111,12 @@ class HomeController < ApplicationController @total_order = Sale.total_order(today,current_user,@from,@to) @total_accounts = Sale.total_account(today,current_user,@from,@to) @account_data = Array.new - @total_accounts.each do |account| - acc = Sale.account_data(account.account_id, today,current_user,@from,@to) - if !acc.nil? - @account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc}) + if !@total_accounts.nil? + @total_accounts.each do |account| + acc = Sale.account_data(account.account_id, today,current_user,@from,@to) + if !acc.nil? + @account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc}) + end end end diff --git a/app/controllers/origami/customers_controller.rb b/app/controllers/origami/customers_controller.rb index f8036a2a..25dc9748 100755 --- a/app/controllers/origami/customers_controller.rb +++ b/app/controllers/origami/customers_controller.rb @@ -63,7 +63,11 @@ class Origami::CustomersController < BaseOrigamiController else @booking_order = BookingOrder.find_by_order_id(@sale_id) @booking = Booking.find(@booking_order.booking_id) - @dining_facility = DiningFacility.find(@booking.dining_facility_id) + if @booking.dining_facility_id.to_i > 0 + @dining_facility = DiningFacility.find(@booking.dining_facility_id) + else + @dining_facility = nil + end end filter = params[:filter] diff --git a/app/models/ability.rb b/app/models/ability.rb index 29f66d34..95c6005f 100755 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -112,10 +112,10 @@ class Ability can :index, :other_charge can :create, :other_charge - # can :index, :discount - # can :create, :discount - # can :remove_discount_items, :discount - # can :remove_all_discount, :discount + can :index, :discount + can :create, :discount + can :remove_discount_items, :discount + can :remove_all_discount, :discount can :member_discount, :discount can :first_bill, :payment @@ -194,6 +194,26 @@ class Ability elsif user.role == "waiter" can :index, :home can :show, :home + + can :manage, Customer + can :get_customer, Customer + can :add_customer, Customer + can :update_sale_by_customer, Customer + + can :index, :other_charge + can :create, :other_charge + can :index, :discount + can :create, :discount + can :remove_discount_items, :discount + can :remove_all_discount, :discount + can :member_discount, :discount + + #ability for move table + can :move_dining, :movetable + can :moving, :movetable + + can :move_dining, :moveroom + #ability for split_bill can :index, :split_bill can :create, :split_bill diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index a30cae23..5251b71f 100755 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -218,7 +218,7 @@ <% end %> <% end %> - <% if current_user.role == 'administrator' || current_user.role == 'manager' %> + <% if current_user.role == 'administrator' %>
+
exit_to_app Logout
diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb index e144d848..87ff1144 100755 --- a/app/views/origami/customers/index.html.erb +++ b/app/views/origami/customers/index.html.erb @@ -467,8 +467,16 @@ { var id = $("#table_id").val(); var type = $("#type").val(); + var booking_id = ""; + <% if !@booking_order.nil? %> + booking_id = "<%= @booking_order.booking_id %>"; + <% end %> if (cashier_type == "quick_service") { + if(booking_id!= "" && page == "pending"){ + window.location.href = '/origami/'+cashier_type+'/pending_order/'+booking_id; + }else{ window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/customers/payment/'; + } }else{ if(page == "payment"){ window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/customers/payment/'; @@ -496,7 +504,10 @@ if (cashier_type == "quick_service") { window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/'; }else{ - if(page == "payment"){ + if(page == "pending"){ + window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/pending/'; + } + else if(page == "payment"){ window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/'; }else{ if (type=="Table") { diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 89884bee..d08d55f4 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -425,10 +425,7 @@ <%= t("views.btn.back") %> - <% if current_login_employee.role == "administrator" || current_login_employee.role == "manager" || current_login_employee.role == "supervisor" || current_login_employee.role == "cashier" || current_login_employee.role == "waiter" %> - <% end %> - <% if current_login_employee.role != "waiter" %> <% if @dining.status != "available" %> <% if @status_order == 'order' && @status_sale != 'sale' %> @@ -455,10 +452,10 @@ <% if current_login_employee.role != "waiter" %> - + <% end %> - <% end %> + <% if !@split_bill.nil? %> <% if @split_bill == '1' %> @@ -515,7 +512,6 @@