diff --git a/app/assets/javascripts/OQS.js b/app/assets/javascripts/OQS.js index 35e08b4f..47c16ad1 100755 --- a/app/assets/javascripts/OQS.js +++ b/app/assets/javascripts/OQS.js @@ -185,7 +185,7 @@ $(document).on('turbolinks:load', function() { $(document).on('click', '.order-item-edit', function(event){ var _self = $(this); // To know in ajax return var assigned_item_id=$(this).attr('id').substr(5); - window.location.href = '/oqs/'+ assigned_item_id + "/edit" + window.location.href = '/oqs/'+ assigned_item_id + "/edit/oqs"; }); // complete for queue item diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 1c006be1..97c413c0 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -46,9 +46,12 @@ class HomeController < ApplicationController elsif @employee.role == "manager" session[:session_token] = @employee.token_session redirect_to dashboard_path - elsif @employee.role == "supervisor" || @employee.role == "waiter" + elsif @employee.role == "supervisor" session[:session_token] = @employee.token_session redirect_to origami_root_path + elsif @employee.role == "waiter" + session[:session_token] = @employee.token_session + redirect_to origami_dashboard_path elsif @employee.role == "account" session[:session_token] = @employee.token_session redirect_to reports_dailysale_index_path @@ -160,7 +163,7 @@ class HomeController < ApplicationController elsif employee.role == "manager" redirect_to dashboard_path elsif employee.role == "waiter" - redirect_to oqs_root_path + redirect_to origami_dashboard_path elsif employee.role == "crm" redirect_to crm_root_path elsif @employee.role == "supervisor" diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb index f8bef2de..52ebdd2c 100755 --- a/app/controllers/oqs/edit_controller.rb +++ b/app/controllers/oqs/edit_controller.rb @@ -1,6 +1,12 @@ class Oqs::EditController < BaseOqsController def index assigned_item_id = params[:id] + @link_type = params[:type] + @dining_type = nil + if params[:type] != 'oqs' + dining = DiningFacility.find_by_id(params[:type]) + @dining_type = dining.type + end assigned_item = AssignedOrderItem.find(assigned_item_id) @order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'"); end diff --git a/app/controllers/origami/dashboard_controller.rb b/app/controllers/origami/dashboard_controller.rb index e47a8e48..a3d08132 100644 --- a/app/controllers/origami/dashboard_controller.rb +++ b/app/controllers/origami/dashboard_controller.rb @@ -55,6 +55,7 @@ class Origami::DashboardController < BaseOrigamiController # get printer info @print_settings = PrintSetting.get_precision_delimiter() + @current_user = current_user end helper_method :shop_detail diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index 3a7501e6..eedbfdfc 100755 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -62,6 +62,7 @@ class Origami::HomeController < BaseOrigamiController @dining.bookings.active.each do |booking| if booking.sale_id.nil? && booking.booking_status != 'moved' @order_items = Array.new + @assigned_order_items = Array.new if booking.booking_orders.empty? @booking = booking else @@ -84,6 +85,10 @@ class Origami::HomeController < BaseOrigamiController item.set_menu_items = arr_instance_item_sets end @order_items.push(item) + assigned_order_items = AssignedOrderItem.find_by_item_code_and_instance_code_and_order_id(item.item_code,item.item_instance_code,item.order_id) + if !assigned_order_items.nil? + @assigned_order_items.push({item.order_items_id => assigned_order_items.assigned_order_item_id}) + end end accounts = @customer.tax_profiles puts accounts.to_json diff --git a/app/controllers/origami/split_bill_controller.rb b/app/controllers/origami/split_bill_controller.rb index 987f68e7..59dd3a71 100644 --- a/app/controllers/origami/split_bill_controller.rb +++ b/app/controllers/origami/split_bill_controller.rb @@ -8,6 +8,7 @@ class Origami::SplitBillController < BaseOrigamiController @orders = Array.new @order_items = Array.new @sale_data = Array.new + @current_user = current_user table_bookings = Booking.where("dining_facility_id = #{dining_id} and sale_id IS NOT NULL") if !table_bookings.nil? diff --git a/app/controllers/origami/table_invoices_controller.rb b/app/controllers/origami/table_invoices_controller.rb index f2dd132a..09535f4a 100755 --- a/app/controllers/origami/table_invoices_controller.rb +++ b/app/controllers/origami/table_invoices_controller.rb @@ -65,6 +65,8 @@ class Origami::TableInvoicesController < BaseOrigamiController if !lookup_spit_bill[0].nil? @split_bill = lookup_spit_bill[0][1] end + # get printer info + @print_settings = PrintSetting.get_precision_delimiter() end #Shop Name in Navbor diff --git a/app/models/ability.rb b/app/models/ability.rb index 7afb6bc4..33372ac9 100755 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -191,6 +191,9 @@ class Ability elsif user.role == "waiter" can :index, :home can :show, :home + #ability for split_bill + can :index, :split_bill + can :create, :split_bill end end end diff --git a/app/pdf/receipt_bill_a5_pdf.rb b/app/pdf/receipt_bill_a5_pdf.rb index c4666963..b3302485 100644 --- a/app/pdf/receipt_bill_a5_pdf.rb +++ b/app/pdf/receipt_bill_a5_pdf.rb @@ -487,17 +487,17 @@ class ReceiptBillA5Pdf < Prawn::Document move_down 5 y_position = cursor bounding_box([0,y_position], :width =>self.label_width+50) do - text "Individual amount for #{sale_data.equal_persons} persons", :size => self.item_font_size+1,:align => :left + text "Split Bill for #{sale_data.equal_persons} persons", :size => self.item_font_size+1,:align => :left end bounding_box([0,y_position], :width =>self.label_width) do move_down 15 - text "Total Amount", :size => self.item_font_size,:align => :left + text "Amount Due (per person)", :size => self.item_font_size,:align => :left end bounding_box([self.label_width,y_position], :width =>self.item_description_width) do move_down 15 - text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)} per person", :size => self.item_font_size,:align => :right + text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right end end diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index aef26a9d..0ae57fea 100755 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -488,17 +488,17 @@ class ReceiptBillPdf < Prawn::Document move_down 5 y_position = cursor bounding_box([0,y_position], :width =>self.label_width+50) do - text "Individual amount for #{sale_data.equal_persons} persons", :size => self.item_font_size+1,:align => :left + text "Split Bill for #{sale_data.equal_persons} persons", :size => self.item_font_size+1,:align => :left end bounding_box([0,y_position], :width =>self.label_width) do move_down 15 - text "Total Amount", :size => self.item_font_size,:align => :left + text "Amount Due (per person)", :size => self.item_font_size,:align => :left end bounding_box([self.label_width,y_position], :width =>self.item_description_width) do move_down 15 - text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)} per person", :size => self.item_font_size,:align => :right + text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right end end diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index ec0a3c68..45cedcc3 100755 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -14,11 +14,11 @@
| Sub Total: | -<%= sub_total %> | +<%= number_with_precision(sub_total, precision: precision.to_i ) %> |
| Discount: | <%end%> -(<%= @sale.total_discount rescue 0%>) | +(<%= number_with_precision(@sale.total_discount, precision: precision.to_i ) rescue 0%>) |
| Tax: | -<%= @sale.total_tax rescue 0%> | +<%= number_with_precision(@sale.total_tax, precision: precision.to_i ) rescue 0%> |
| Rounding Adj: | -<%= @sale.rounding_adjustment rescue 0%> | +<%= number_with_precision(@sale.rounding_adjustment, precision: precision.to_i ) rescue 0%> |
| Grand Total: | -<%= @sale.grand_total rescue 0%> | +<%= number_with_precision(@sale.grand_total, precision: precision.to_i ) rescue 0%> |