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' %>
<% else %> @@ -262,11 +262,11 @@
- <% if current_user.role == 'administrator' || current_user.role == 'manager' %> + <% if current_user.role == 'administrator' %> <% end %> - <% if current_user.role == 'administrator' || current_user.role == 'manager' %> + <% if current_user.role == 'administrator' %>
<% else %> diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 5f1fe42d..2207fef7 100755 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -57,7 +57,7 @@ exit_to_app Logout

--> -

+

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" %> @@ -515,7 +512,6 @@
- <% end %> diff --git a/app/views/origami/moveroom/move_dining.html.erb b/app/views/origami/moveroom/move_dining.html.erb index 9ff2f6e9..b46834ca 100755 --- a/app/views/origami/moveroom/move_dining.html.erb +++ b/app/views/origami/moveroom/move_dining.html.erb @@ -44,11 +44,15 @@
<% @rooms.each do |room| %> <% if room.status == 'occupied' %> -
-
- <%= room.name %> -
-
+ <% if room.get_booking.nil? %> +
+ <% else %> +
+ <% end %> +
+ <%= room.name %> +
+
<% else %>
diff --git a/app/views/origami/movetable/move_dining.html.erb b/app/views/origami/movetable/move_dining.html.erb index 131407f0..4385cad7 100755 --- a/app/views/origami/movetable/move_dining.html.erb +++ b/app/views/origami/movetable/move_dining.html.erb @@ -59,18 +59,22 @@
<% @rooms.each do |room| %> <% if room.status == 'occupied' %> -
-
+ <% if room.get_booking.nil? %> +
+ <% else %> +
+ <% end %> +
+ <%= room.name %> +
+
+ <% else %> +
+
<%= room.name %>
- <% else %> -
-
- <%= room.name %> -
-
- <% end %> + <% end %> <% end %>
diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index d212f46b..c233a63c 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -708,7 +708,7 @@ var customer_name = "<%= @customer.name %>"; var sale_id = $('#dining').text(); } //var table_id = $('.tables').attr("data-id"); - window.location.href = '/origami/' + sale_id +"/"+ cashier_type + "/surveys" + window.location.href = '/origami/' + sale_id +"/"+ cashier_type + "/surveys"; }); // bind customer to order or sale @@ -720,7 +720,7 @@ var customer_name = "<%= @customer.name %>"; var sale_id = $('#save_order_id').attr('data-order'); } var table_id = $('.tables').attr("data-id"); - window.location.href = '/origami/' + sale_id + "/"+cashier_type+"/customers" + window.location.href = '/origami/' + sale_id + "/"+cashier_type+"/customers/payment"; }); // Add Other Charges diff --git a/app/views/origami/pending_order/show.html.erb b/app/views/origami/pending_order/show.html.erb index d94a81d5..fade7ccb 100644 --- a/app/views/origami/pending_order/show.html.erb +++ b/app/views/origami/pending_order/show.html.erb @@ -153,6 +153,14 @@ <% if current_user.role != "waiter" || @status != "sale"%> <%end%> + <% if current_user.role != "waiter" && @status != "order"%> <%end%> @@ -163,6 +171,7 @@
diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index 3826df57..6ece5bda 100755 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -392,10 +392,7 @@ - <% 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 @room.bookings.length >= 1 %> <% if @status_order == 'order' && @status_sale != 'sale' %> @@ -419,14 +416,14 @@ <% if current_login_employee.role != "waiter" %> + + @@ -481,7 +478,6 @@ <% end %> <% end %> - <% end %>
@@ -582,7 +578,7 @@ $(document).ready(function(){ var sale_id = "<%= @room.id %>"; } //var table_id = $('.tables').attr("data-id"); - window.location.href = '/origami/' + sale_id + "/surveys" + window.location.href = '/origami/' + sale_id +"/"+cashier_type+ "/surveys" }); // bind customer to order or sale $("#customer").on('click', function(){ @@ -617,7 +613,7 @@ $(document).ready(function(){ } if (sale_id != "") { - window.location.href = '/origami/' + sale_id + '/discount' + window.location.href = '/origami/' + sale_id +"/"+cashier_type+ '/discount' } else { swal ( "Oops" , "Please select an table!" , "warning" ); @@ -639,7 +635,7 @@ $(document).ready(function(){ } if(sale_id!=""){ - window.location.href = '/origami/' + sale_id + '/other_charges' + window.location.href = '/origami/' + sale_id +"/"+cashier_type+ '/other_charges' } else { swal ( "Oops" , "Please select an table!" , "warning" );