From 48ce8e4809351947d9e28a0429f5d256a26aff19 Mon Sep 17 00:00:00 2001 From: phyusin Date: Thu, 1 Feb 2018 18:12:59 +0630 Subject: [PATCH 01/15] split bill --- .../javascripts/origami/split_bill.coffee | 3 + .../stylesheets/origami/split_bill.scss | 3 + .../origami/split_bill_controller.rb | 7 + app/helpers/origami/split_bill_helper.rb | 2 + app/views/origami/home/show.html.erb | 44 +- app/views/origami/split_bill/index.html.erb | 780 ++++++++++++++++++ config/routes.rb | 2 + .../origami/split_bill_controller_spec.rb | 5 + .../helpers/origami/split_bill_helper_spec.rb | 15 + 9 files changed, 846 insertions(+), 15 deletions(-) create mode 100644 app/assets/javascripts/origami/split_bill.coffee create mode 100644 app/assets/stylesheets/origami/split_bill.scss create mode 100644 app/controllers/origami/split_bill_controller.rb create mode 100644 app/helpers/origami/split_bill_helper.rb create mode 100755 app/views/origami/split_bill/index.html.erb create mode 100644 spec/controllers/origami/split_bill_controller_spec.rb create mode 100644 spec/helpers/origami/split_bill_helper_spec.rb diff --git a/app/assets/javascripts/origami/split_bill.coffee b/app/assets/javascripts/origami/split_bill.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/origami/split_bill.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/origami/split_bill.scss b/app/assets/stylesheets/origami/split_bill.scss new file mode 100644 index 00000000..343bce7f --- /dev/null +++ b/app/assets/stylesheets/origami/split_bill.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the origami/split_bill controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/origami/split_bill_controller.rb b/app/controllers/origami/split_bill_controller.rb new file mode 100644 index 00000000..24ded975 --- /dev/null +++ b/app/controllers/origami/split_bill_controller.rb @@ -0,0 +1,7 @@ +class Origami::SplitBillController < BaseOrigamiController + + def index + dining_id = params[:dining_id] + @table = DiningFacility.find_by_id(dining_id) + end +end diff --git a/app/helpers/origami/split_bill_helper.rb b/app/helpers/origami/split_bill_helper.rb new file mode 100644 index 00000000..cc88e5b2 --- /dev/null +++ b/app/helpers/origami/split_bill_helper.rb @@ -0,0 +1,2 @@ +module Origami::SplitBillHelper +end diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 8440f354..4f81116d 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -670,22 +670,36 @@ // Bill Request $('#request_bills').click(function () { - var order_id = $('#save_order_id').attr('data-order'); - var ajax_url = "/origami/" + order_id + "/request_bills"; - $.ajax({ - type: "GET", - url: ajax_url, - // data: 'order_id='+ order_id, - success: function (result) { - - if (!result.status) { - swal("Information!", result.error_message); + swal({ + title: "Alert", + text: "Are you sure want to Split?", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "Yes, split it!", + closeOnConfirm: false + }, function (isConfirm) { + if (isConfirm) { + var dining_id = "<%= @dining.id %>"; + window.location.href = '/origami/table/' + dining_id + "/split_bill"; + }else{ + var order_id = $('#save_order_id').attr('data-order'); + var ajax_url = "/origami/" + order_id + "/request_bills"; + $.ajax({ + type: "GET", + url: ajax_url, + // data: 'order_id='+ order_id, + success: function (result) { + if (!result.status) { + swal("Information!", result.error_message); + } + else { + location.reload(); + } } - else { - location.reload(); - } - } - }); + }); + } + }); }); $('#move').on('click', function () { diff --git a/app/views/origami/split_bill/index.html.erb b/app/views/origami/split_bill/index.html.erb new file mode 100755 index 00000000..0691ca2c --- /dev/null +++ b/app/views/origami/split_bill/index.html.erb @@ -0,0 +1,780 @@ +
+ +
+ +
+ +
+ +
+
+
+ + +
+
+

Date: <%=@sale_data.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

+
+
+
+
+ + + + + + + + + + <% sub_total = 0 %> + <% @sale_data.sale_items.each do |sale_item| %> + <% + sub_total += sale_item.qty*sale_item.unit_price + if sale_item.price != 0 && sale_item.remark != "void" && sale_item.remark != "foc" + %> + > + + + + + <% + end + end + %> + +
ItemsQTYPrice
+ + <%=sale_item.product_name%>@<%=sale_item.unit_price%> + + <%=sale_item.qty%> + + <%=(sale_item.qty*sale_item.unit_price)%> +
+
+
+ +
+
+
+ + + +
+ +
+
+
Discount Control
+
+
+
+
+
+
+ +
+
+
+ <% + @accounts.each do |acc| + %> + + <% end %> +
+
+
+
+ +
+
+
+
+
+
+
5%
+
+
+
+
1
+
2
+
3
+
+
+
+ +
+
+
10%
+
+
+
+
4
+
5
+
6
+
+
+
+ +
+
+
15%
+
+
+
+
7
+
8
+
9
+
+
+
+ +
+
+
20%
+
+
+
+
0
+
.
+
00
+
+
+
+ +
+
+
30%
+
+
+
+
+
DEL
+
CLR
+
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+ + +
+ +
+ + + + + <% if @member_discount%> + + <%end %> +
+
+
+
+ + diff --git a/config/routes.rb b/config/routes.rb index 7d21aeb5..58fd5ffd 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -220,6 +220,8 @@ scope "(:locale)", locale: /en|mm/ do post "bank_integration/settle_trans", to: "bank_integration#settle_trans", as:"settle_trans" post "bank_integration/sale_trans", to: "bank_integration#sale_trans", as:"sale_trans" + #split bill + get 'table/:dining_id/split_bill' => 'split_bill#index', as:'split_bill_index' end #--------- Waiter/Ordering Station ------------# diff --git a/spec/controllers/origami/split_bill_controller_spec.rb b/spec/controllers/origami/split_bill_controller_spec.rb new file mode 100644 index 00000000..2ab33eb0 --- /dev/null +++ b/spec/controllers/origami/split_bill_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Origami::SplitBillController, type: :controller do + +end diff --git a/spec/helpers/origami/split_bill_helper_spec.rb b/spec/helpers/origami/split_bill_helper_spec.rb new file mode 100644 index 00000000..db065ff0 --- /dev/null +++ b/spec/helpers/origami/split_bill_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the Origami::SplitBillHelper. For example: +# +# describe Origami::SplitBillHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe Origami::SplitBillHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end From d1fd92bfd326b9d36e7521ad0bfed00225475f0e Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 2 Feb 2018 13:41:38 +0630 Subject: [PATCH 02/15] split bill ui --- .../origami/split_bill_controller.rb | 16 +- app/views/origami/home/show.html.erb | 4 +- app/views/origami/split_bill/index.html.erb | 582 +++++------------- config/routes.rb | 2 +- 4 files changed, 183 insertions(+), 421 deletions(-) diff --git a/app/controllers/origami/split_bill_controller.rb b/app/controllers/origami/split_bill_controller.rb index 24ded975..87b8644d 100644 --- a/app/controllers/origami/split_bill_controller.rb +++ b/app/controllers/origami/split_bill_controller.rb @@ -2,6 +2,20 @@ class Origami::SplitBillController < BaseOrigamiController def index dining_id = params[:dining_id] - @table = DiningFacility.find_by_id(dining_id) + @table = DiningFacility.find(dining_id) + @booking = @table.get_booking + @order_items = Array.new + if @booking + @booking.booking_orders.each do |booking_order| + @order = Order.find(booking_order.order_id) + if (@order.status == "new") + @order.order_items.each do |item| + @order_items.push(item) + end + end + end + else + @booking = nil + end end end diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index bc068a1d..f9599783 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -674,7 +674,7 @@ $('#request_bills').click(function () { swal({ title: "Alert", - text: "Are you sure want to Split?", + text: "Do you want to Split bill?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", @@ -683,7 +683,7 @@ }, function (isConfirm) { if (isConfirm) { var dining_id = "<%= @dining.id %>"; - window.location.href = '/origami/table/' + dining_id + "/split_bill"; + window.location.href = '/origami/table/' + dining_id + "/split_bills"; }else{ var order_id = $('#save_order_id').attr('data-order'); var ajax_url = "/origami/" + order_id + "/request_bills"; diff --git a/app/views/origami/split_bill/index.html.erb b/app/views/origami/split_bill/index.html.erb index 0691ca2c..9aa09d37 100755 --- a/app/views/origami/split_bill/index.html.erb +++ b/app/views/origami/split_bill/index.html.erb @@ -1,7 +1,7 @@
- +
@@ -13,84 +13,58 @@
- - + + +

Order No: <%=@order.order_id rescue ' '%>

-

Date: <%=@sale_data.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

+

Date: <%=@order.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

-
- - - - - +
+
ItemsQTY
+ + + + - - - - <% sub_total = 0 %> - <% @sale_data.sale_items.each do |sale_item| %> - <% - sub_total += sale_item.qty*sale_item.unit_price - if sale_item.price != 0 && sale_item.remark != "void" && sale_item.remark != "foc" - %> - > - - - - - <% - end - end + + + + <% sub_total = 0 %> + <% @order_items.each do |order_item| %> + <% + sub_total += order_item.qty*order_item.price %> - -
ItemsQTY Price
- - <%=sale_item.product_name%>@<%=sale_item.unit_price%> - - <%=sale_item.qty%> - - <%=(sale_item.qty*sale_item.unit_price)%> -
-
-
- -
+ > + + + <%=order_item.item_name%>@<%=order_item.price%> + + + <%=order_item.qty%> + + + <%=(order_item.qty*order_item.price)%> + + + <% + end + %> + + +
+
+ +
@@ -100,173 +74,116 @@
-
Discount Control
+
Split Bill Control
-
- +
+
-
-
- <% - @accounts.each do |acc| - %> - - <% end %> -
-
-
+
+
-
-
-
-
+
+ +
+
+
-
-
5%
-
-
-
-
1
-
2
-
3
-
-
-
- -
-
-
10%
-
-
-
-
4
-
5
-
6
-
-
+
1
+
2
+
3
-
-
15%
-
-
-
-
7
-
8
-
9
-
-
+
4
+
5
+
6
-
-
20%
-
-
-
-
0
-
.
-
00
-
-
+
7
+
8
+
9
-
-
30%
-
-
-
-
-
DEL
-
CLR
-
-
+
0
+
DEL
+
CLR
- - - + + +
-
-
+
+ - -
- -
- - - - - <% if @member_discount%> - - <%end %> -
+ +
+ +
+ + + +
+ diff --git a/config/routes.rb b/config/routes.rb index 58fd5ffd..12c263d5 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -221,7 +221,7 @@ scope "(:locale)", locale: /en|mm/ do post "bank_integration/sale_trans", to: "bank_integration#sale_trans", as:"sale_trans" #split bill - get 'table/:dining_id/split_bill' => 'split_bill#index', as:'split_bill_index' + get '/table/:dining_id/split_bills' => 'split_bill#index', as:'split_bill_index' end #--------- Waiter/Ordering Station ------------# From 991bc48505b9c46c1dc6ce38ba2b9faeb09193df Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 6 Feb 2018 09:46:30 +0630 Subject: [PATCH 03/15] order item split bill process --- README.md | 2 + app/controllers/api/bill_controller.rb | 2 +- app/controllers/base_origami_controller.rb | 5 + app/controllers/origami/home_controller.rb | 6 + .../origami/split_bill_controller.rb | 51 ++ app/models/ability.rb | 4 + app/views/origami/home/show.html.erb | 55 +- app/views/origami/orders/show.html.erb | 81 ++- app/views/origami/split_bill/index.html.erb | 607 +++++------------- config/routes.rb | 1 + 10 files changed, 309 insertions(+), 505 deletions(-) diff --git a/README.md b/README.md index 8c5cf006..8655b6d9 100755 --- a/README.md +++ b/README.md @@ -103,6 +103,8 @@ Change type in mysql => ALTER TABLE [table_name] CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci #for table => ALTER DATABASE [database_name] CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci #for database +For split bill + 1) settings/lookups => { type:split_bill, name:SplitBill, value:1 } * ToDo list diff --git a/app/controllers/api/bill_controller.rb b/app/controllers/api/bill_controller.rb index 387b7bf8..2c2ac133 100755 --- a/app/controllers/api/bill_controller.rb +++ b/app/controllers/api/bill_controller.rb @@ -5,7 +5,7 @@ class Api::BillController < Api::ApiController def create @status = false @error_message = "Order ID or Booking ID is require to request for a bill." - + byebug if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id) #create Bill by Booking ID table = 0 diff --git a/app/controllers/base_origami_controller.rb b/app/controllers/base_origami_controller.rb index ec415bad..e448cf17 100755 --- a/app/controllers/base_origami_controller.rb +++ b/app/controllers/base_origami_controller.rb @@ -18,4 +18,9 @@ class BaseOrigamiController < ActionController::Base # def checkin_process # CheckinJob.set(wait: 1.minute).perform_later() # end + + # Get current Cashier + def get_cashier + @cashier = Employee.where("role = 'cashier' AND token_session <> ''") + end end diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index c00b39bf..d90d7f2d 100755 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -88,6 +88,12 @@ class Origami::HomeController < BaseOrigamiController #for bank integration @checkout_time = Lookup.collection_of('checkout_time') @checkout_alert_time = Lookup.collection_of('checkout_alert_time') + #for split bill + lookup_spit_bill = Lookup.collection_of('split_bill') + @spit_bill = 0 + if !lookup_spit_bill[0].nil? + @spit_bill = lookup_spit_bill[0][1] + end end private diff --git a/app/controllers/origami/split_bill_controller.rb b/app/controllers/origami/split_bill_controller.rb index 87b8644d..59cdae1e 100644 --- a/app/controllers/origami/split_bill_controller.rb +++ b/app/controllers/origami/split_bill_controller.rb @@ -1,4 +1,5 @@ class Origami::SplitBillController < BaseOrigamiController + authorize_resource :class => false def index dining_id = params[:dining_id] @@ -18,4 +19,54 @@ class Origami::SplitBillController < BaseOrigamiController @booking = nil end end + + def create + order_items = JSON.parse(params[:order_items]) + # byebug + status = false + if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id) + #create Bill by Booking ID + table = 0 + if !params[:booking_id].empty? + booking = Booking.find(params[:booking_id]) + # for Multiple Cashier by Zone + table = DiningFacility.find(booking.dining_facility_id) + + cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id) + + shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil) + get_cashier_by_terminal = Employee.find(shift_by_terminal.employee_id) + + if booking + if booking.sale_id.nil? + sale = Sale.new + status, sale_id = sale.generate_invoice_from_booking(params[:booking_id], current_user, get_cashier_by_terminal) + sale_data = Sale.find_by_sale_id(sale_id) + else + status = true + sale_id = booking.sale_id + sale_data = Sale.find_by_sale_id(sale_id) + end + end + else + puts "new booking" + puts "new order" + puts "update order_id in order" + puts "do process" + end + + # Bind shift sale id to sale + sale_data.shift_sale_id = shift_by_terminal.id + sale_data.save + + Promotion.promo_activate(sale) + + BillBroadcastJob.perform_later(table) + + render :json => { status: status } + else + render :json => { status: false, error_message: 'No Current Open Shift!'} + end + end + end diff --git a/app/models/ability.rb b/app/models/ability.rb index a72a47d2..406d757a 100755 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -132,6 +132,10 @@ class Ability can :manage, Commissioner can :manage, Promotion can :manage, Product + + #ability for split_bill + can :index, :split_bill + can :create, :split_bill elsif user.role == "account" diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index f9599783..edbcaced 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -672,7 +672,9 @@ // Bill Request $('#request_bills').click(function () { - swal({ + var lookup_split_bill = '<%= @spit_bill %>'; + if(lookup_split_bill == '1'){ + swal({ title: "Alert", text: "Do you want to Split bill?", type: "warning", @@ -680,30 +682,37 @@ confirmButtonColor: "#DD6B55", confirmButtonText: "Yes, split it!", closeOnConfirm: false - }, function (isConfirm) { - if (isConfirm) { - var dining_id = "<%= @dining.id %>"; - window.location.href = '/origami/table/' + dining_id + "/split_bills"; - }else{ - var order_id = $('#save_order_id').attr('data-order'); - var ajax_url = "/origami/" + order_id + "/request_bills"; - $.ajax({ - type: "GET", - url: ajax_url, - // data: 'order_id='+ order_id, - success: function (result) { - if (!result.status) { - swal("Information!", result.error_message); - } - else { - location.reload(); - } - } - }); - } - }); + }, function (isConfirm) { + if (isConfirm) { + var dining_id = "<%= @dining.id %>"; + window.location.href = '/origami/table/' + dining_id + "/split_bills"; + }else{ + requestBillProcess(); + } + }); + }else{ + requestBillProcess(); + } }); + function requestBillProcess(){ + var order_id = $('#save_order_id').attr('data-order'); + var ajax_url = "/origami/" + order_id + "/request_bills"; + $.ajax({ + type: "GET", + url: ajax_url, + // data: 'order_id='+ order_id, + success: function (result) { + if (!result.status) { + swal("Information!", result.error_message); + } + else { + location.reload(); + } + } + }); + } + $('#move').on('click', function () { var dining_id = "<%= @dining.id %>"; window.location.href = '/origami/table/' + dining_id + "/movetable"; diff --git a/app/views/origami/orders/show.html.erb b/app/views/origami/orders/show.html.erb index b08328b6..70e1ba9d 100755 --- a/app/views/origami/orders/show.html.erb +++ b/app/views/origami/orders/show.html.erb @@ -39,22 +39,37 @@
<% @tables.each do |table| %> <% if table.status == 'occupied' %> -
-
- <%= table.name %> - <% if table.get_booking.nil? %> - billed - <% else %> - new - <% end %> -
-
+ <% if table.get_booking.nil? %> + <% if table.get_checkout_booking.nil? %> +
+ <% else %> +
+ <% end %> +
+ <%= table.name %> + billed +
+
+
+ <% else %> + <% if table.get_checkout_booking.nil? %> +
+ <% else %> +
+ <% end %> +
+ <%= table.name %> + new +
+
+ <% end %> <% else %> -
-
+
+
<%= table.name %> -
-
+ new +
+
<% end %> <% end %>
@@ -64,24 +79,30 @@
<% @rooms.each do |room| %> - <% if room.status == 'occupied' %> -
-
- <%= room.name %> - <% if room.get_booking.nil? %> - billed + <% if room.status == 'occupied' %> + <% if room.get_booking.nil? %> +
+
+ <%= room.name %> + billed +
+
<% else %> - new +
+
+ <%= room.name %> + new +
+
<% end %> -
-
- <% else %> -
-
- <%= room.name %> -
-
- <% end %> + <% else %> +
+
+ <%= room.name %> + +
+
+ <% end %> <% end %>
diff --git a/app/views/origami/split_bill/index.html.erb b/app/views/origami/split_bill/index.html.erb index 9aa09d37..c96e2674 100755 --- a/app/views/origami/split_bill/index.html.erb +++ b/app/views/origami/split_bill/index.html.erb @@ -4,139 +4,78 @@
-
+
- -
-
-
- - -

Order No: <%=@order.order_id rescue ' '%>

-
-
-

Date: <%=@order.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

-
-
-
-
- - - - - - - - - - <% sub_total = 0 %> - <% @order_items.each do |order_item| %> - <% - sub_total += order_item.qty*order_item.price - %> - > - - - - - <% - end - %> - -
ItemsQTYPrice
- - <%=order_item.item_name%>@<%=order_item.price%> - - <%=order_item.qty%> - - <%=(order_item.qty*order_item.price)%> -
-
-
- -
-
+ +
+
+
+ + +

Order No: <%=@order.order_id rescue ' '%>

+
+
+

Date: <%=@order.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

+
+
+
+
+ + + + + + + + + + <% sub_total = 0 %> + <% @order_items.each do |order_item| %> + <% + sub_total += order_item.qty*order_item.price + %> + > + + + + + <% + end + %> + +
ItemsQTYPrice
+ + <%=order_item.item_name%> + + <%=order_item.qty%> + + <%=(order_item.qty*order_item.price)%> +
+
+
+ +
+
- +
-
- -
-
-
Split Bill Control
-
-
-
-
-
-
- -
-
-
-
- -
- -
-
-
-
-
1
-
2
-
3
-
- -
-
4
-
5
-
6
-
- -
-
7
-
8
-
9
-
- -
-
0
-
DEL
-
CLR
-
-
-
-
- - - -
-
-
-
-
-
-
- -
- - - + +
@@ -146,13 +85,7 @@ $(document).ready(function(){ $('#back').on('click',function(){ - var id = $("#table_id").text(); - var type = $("#table_type").text(); - if (type=="Table") { - window.location.href = '/origami/table/'+id - }else{ - window.location.href = '/origami/room/'+id - } + backToOrigami(); }) $(".cashier_number").on('click', function(event){ @@ -162,28 +95,28 @@ var input_type = $(this).attr("data-type"); switch (input_type) { case 'num': - var input_value = $(this).attr("data-value"); - if (original_value == "0"){ - $('#per_person').val(input_value); - } - else{ - $('#per_person').val(original_value + '' + input_value); - } + var input_value = $(this).attr("data-value"); + if (original_value == "0"){ + $('#per_person').val(input_value); + } + else{ + $('#per_person').val(original_value + '' + input_value); + } break; case 'add': - var input_value = $(this).attr("data-value"); - amount = parseInt(input_value); - $('#per_person').val(amount); + var input_value = $(this).attr("data-value"); + amount = parseInt(input_value); + $('#per_person').val(amount); break; case 'del' : - var discount_text=$('#per_person').val(); - $('#per_person').val(discount_text.substr(0,discount_text.length-1)); + var discount_text=$('#per_person').val(); + $('#per_person').val(discount_text.substr(0,discount_text.length-1)); break; case 'clr': - $('#per_person').val("0"); + $('#per_person').val("0"); break; } event.handled = true; @@ -202,327 +135,99 @@ } }); - // Select discount-item - $('#order-items-table tbody').on('click', '.discount-item-row',function(){ - if($(this).hasClass('selected-item') == true){ - $(this).removeClass('selected-item'); - } - else { - $(this).addClass('selected-item'); - } - }); - - // Calculate Net Discount for Payment - $("#net").on('click', function(e){ - e.preventDefault(); - var sale_id = $('#sale-id').text(); - var discount_value = parseFloat($('#discount-amount').val()); - var ajax_url = "/origami/" + sale_id + "/discount"; - - // Selected Items - var sale_items = get_selected_sale_items(); - - // Selected Account - var account_types = get_selected_account_types(); - - if(sale_items.length == 0 && account_types.length == 0){ - calculate_overall_discount(0, discount_value); - } - else { - calculate_item_discount(0, discount_value, sale_items, account_types); - } - - // Remove Selection - selection_remove(); - }); - - // Calculate Percentage Discount for Payment - $("#percentage").on('click', function(e){ - e.preventDefault(); - var sale_id = $('#sale-id').text(); - var discount_value = $('#discount-amount').val(); - var ajax_url = "/origami/" + sale_id + "/discount"; - - // Selected Items - var sale_items = get_selected_sale_items(); - - // Selected Account - var account_types = get_selected_account_types(); - - if(sale_items.length == 0 && account_types.length == 0){ - calculate_overall_discount(1, discount_value); - } - else { - calculate_item_discount(1, discount_value, sale_items, account_types); - } - - // Remove Selection - selection_remove(); - }); - - // Remove selected discount items - $("#remove-item").on('click', function(e){ - e.preventDefault(); - var origin_sub_total = parseFloat($("#order-sub-total").text()); - var total = 0; - - $('.discount-item-row.selected-item').each(function(i){ - var amount = parseFloat($(this).find('#item-total-price').text()); - total = total + Math.abs(amount); - $(this).remove(); - }); - $("#order-sub-total").text(origin_sub_total + total); - }); - - // Pay Discount for Payment - $("#pay-discount").on('click', function(e){ - e.preventDefault(); - $("#loading_wrapper").show(); - var sale_id = $('#sale-id').text(); - var discount_items = JSON.stringify(get_discount_item_rows()); - var overall_discount = $("#order-discount").text(); - var sub_total = $('#order-sub-total').text(); - var ajax_url = "/origami/" + sale_id + "/discount"; - - var params = { 'sale_id': sale_id, 'sub_total': sub_total, 'discount_items': discount_items, 'overall_discount': overall_discount }; - - $.ajax({ - type: "POST", - url: ajax_url, - data: params, - success:function(result){ - $("#loading_wrapper").hide(); + //order_item_split + $('#order_item_split').on('click',function () { + var cnt_order_item = "<%= @order_items.count %>"; + var order_items = get_selected_order_items();// Selected Order Items + var cnt_items = parseInt(cnt_order_item) - parseInt(order_items.length); + if (order_items.length > 0){ + if(cnt_items > 0){ swal({ - title: "Information!", - text: result.status, - }, function () { - if(result.table_type == "Table"){ - window.location.href = "/origami/table/" + result.table_id - } - else { - window.location.href = "/origami/room/" + result.table_id - } - }); + title: "Alert", + text: "Are you sure, you want to Split?", + type: "warning", + showCancelButton: true, + confirmButtonColor: "#DD6B55", + confirmButtonText: "Yes, split it!", + closeOnConfirm: false + }, function (isConfirm) { + if(isConfirm){ + splitBillProcess(cnt_items); + } + }); } - }); - }); - - // Remove selected given discount item - $("#remove-item-discount").on('click', function(e){ - e.preventDefault(); - var sale_id = $('#sale-id').text(); - var discount_items = []; - - // Selected Items - var sale_items = get_selected_sale_items(); - console.log(sale_items.length); - if(sale_items.length == 0){ - //swal("Information!", "You have no selected item!"); - swal ( "Oops" , "You have no selected item!" , "error" ); - return; + else{ + splitBillProcess(cnt_items); + } + }else{ + swal("Opps","Please select at least on item!","warning"); } - - for(var i=0;i < sale_items.length;i++){ - if(sale_items[i].price < 0){ - discount_items.push(sale_items[i]); - } - else { - swal ("Oops" , "You have no selected item!" , "error" ); - return; - } - } - - var params = { 'sale_id': sale_id, 'discount_items': JSON.stringify(discount_items) }; - $.ajax({ - type: "POST", - url: "/origami/" + sale_id + "/remove_discount_items", - data: params, - success: function(result){ - swal({ - title: "Information!", - text: result.status, - type: "success", - }, function () { - if(result.table_type == "Table"){ - window.location.href = "/origami/table/" + result.table_id - } - else { - window.location.href = "/origami/room/" + result.table_id - } - }); - } - }); }); +}); - $("#remove-all").on('click', function(e){ - e.preventDefault(); - var sale_id = $('#sale-id').text(); - $.ajax({ - type: "GET", - url: "/origami/" + sale_id + "/remove_all_discount", - success: function(result){ - swal({ - title: "Information!", - text: result.status, - type: "success", - }, function () { - if(result.table_type == "Table"){ - window.location.href = "/origami/table/" + result.table_id - } - else { - window.location.href = "/origami/room/" + result.table_id - } - }); - } - }); - }); +/* function for split bill process */ +function splitBillProcess(cnt_items){ + var order_items = get_selected_order_items();// Selected Order Items + var json_booking = JSON.parse('<%= @booking.to_json.html_safe %>'); + var booking_id = ""; + if(cnt_items == 0){ + booking_id = json_booking.booking_id; + } - /* Remove Selection */ - function selection_remove(){ - $(".item-row").removeClass("selected-item"); - } + var ajax_url = "/origami/split_bills"; + $.ajax({ + type: "POST", + url: ajax_url, + dataType: 'JSON', + data: {'booking_id' : booking_id, 'order_items' : JSON.stringify(order_items)}, + success: function (result) { + if (!result.status) { + swal("Information!", result.error_message); + } + else { + if (cnt_items > 0){ + window.location.reload(); + }else{ + backToOrigami(); + } + } + } + }); +} - /* Get Item rows but not discount*/ - function get_item_rows(){ - var sale_items = []; - $('.item-row').not('.discount-item-row').each(function(i){ - var sale_item = {}; - sale_item.id = $(this).attr('id').substr(0,16); - sale_item.name = $(this).find('#item-name-price').text().split('@')[0]; - sale_item.account_id = $(this).find('#item-account-type').text(); - sale_item.price = $(this).find('#item-total-price').text(); - sale_items.push(sale_item); - }); - return sale_items; - } - - /* Get discount Item rows */ - function get_discount_item_rows(){ - var sale_items = []; - $('.discount-item-row').each(function(i){ - var sale_item = {}; - sale_item.id = $(this).attr('id'); - sale_item.name = $(this).find('#item-name-price').text(); - sale_item.account_id = $(this).find('#item_account_type').text(); - sale_item.price = $(this).find('#item-total-price').text(); - sale_items.push(sale_item); - }); - return sale_items; - } +/* back to origami */ +function backToOrigami(){ + var id = $("#table_id").text(); + var type = $("#table_type").text(); + if (type=="Table") { + window.location.href = '/origami/table/'+id + }else{ + window.location.href = '/origami/room/'+id + } +} /* Get Selected Sale Item's ID and Price */ -function get_selected_sale_items(){ - var sale_items = []; +function get_selected_order_items(){ + var order_items = []; $('.item-row.selected-item').each(function(i){ - var sale_item = {}; - sale_item.id = $(this).attr('id').substr(0,16); - sale_item.name = $(this).find('#item-name-price').text().split('@')[0]; - sale_item.account_id = $(this).find('#item-account-type').text(); - sale_item.price = $(this).find('#item-total-price').text(); - sale_items.push(sale_item); + var order_item = {}; + order_item.id = $(this).attr('id').substr(0,16); + order_item.name = $(this).find('#item-name-price').text().split('@')[0]; + order_item.account_id = $(this).find('#item-account-type').text(); + order_item.price = $(this).find('#item-total-price').text(); + order_items.push(order_item); }); - return sale_items; -} - -/* Get Selected Accounts ID and Price */ -function get_selected_account_types(){ - var account_types = []; - - $('.selected-account').each(function(i){ - var account= {}; - account.id = $(this).attr('id').substr(8); - account.name = $(this).text(); - account_types.push(account); - }); - return account_types; -} - -/* Calculate Overall Discount*/ -function calculate_overall_discount(type, amount){ - var origin_sub_total = parseFloat($("#order-sub-total").text()); - var dis_amount = 0; - var sub_total = 0; - var total_discount = 0; - - // For Net Pay - if(type == 0){ - total_discount = amount; - } - - // For Percentage Pay - if(type == 1){ - if(amount > 100 ){ - swal({ - title:"Oops!", - text:'Percentage Value over 100!', - type: "error", - confirmButtonText: 'OK', - confirmButtonColor:"red" - }); - } - else{ - total_discount = (origin_sub_total * amount)/100; - } - } - - $("#order-discount").text(total_discount); -} - -/* Calculate Items Discount*/ -function calculate_item_discount(type, amount, sale_items, account_types){ - var origin_sub_total = parseFloat($("#order-sub-total").text()); - var dis_amount = 0; - var sub_total = 0; - var total_discount = 0; - // For Net Pay - if(type == 0){ - dis_amount = (0 - amount); - if(sale_items.length > 0){ - for(var i=0;i < sale_items.length;i++){ - var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount); - $("#order-items-table tbody").append(discount_item_row); - total_discount = total_discount + amount; - } - } - - sub_total = origin_sub_total - total_discount; - } - - // For Percentage Pay - if(type == 1){ - if(amount > 100 ){ - swal({ - title:"Oops!", - text:'Percentage Value over 100!', - type: "error", - confirmButtonText: 'OK', - confirmButtonColor:"red" - }); - } - else{ - // Check sale items exists - if(sale_items.length > 0){ - for(var i=0;i < sale_items.length;i++){ - dis_amount = 0 - ((sale_items[i].price * amount)/100); - var discount_item_row = item_row_template(type,sale_items[i], dis_amount, amount); - $("#order-items-table tbody").append(discount_item_row); - total_discount = total_discount + dis_amount; - } - sub_total = origin_sub_total + total_discount; - } - } - } - - $("#order-sub-total").text(sub_total); + return order_items; } //check for isNumber function isNumberKey(evt) { - var charCode = (evt.which) ? evt.which : event.keyCode; - if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) { - return false; - } else { - return true; - } + var charCode = (evt.which) ? evt.which : event.keyCode; + if (charCode > 31 && (charCode < 48 || charCode > 57)) { + return false; + } else { + return true; + } } + diff --git a/config/routes.rb b/config/routes.rb index 12c263d5..5afcb32e 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -222,6 +222,7 @@ scope "(:locale)", locale: /en|mm/ do #split bill get '/table/:dining_id/split_bills' => 'split_bill#index', as:'split_bill_index' + post '/split_bills', to: 'split_bill#create', as:"order_item_split_bills" end #--------- Waiter/Ordering Station ------------# From 8fed8d701a15a302ae60721c653914791eca407f Mon Sep 17 00:00:00 2001 From: phyusin Date: Mon, 5 Feb 2018 11:05:58 +0630 Subject: [PATCH 04/15] add booking --- app/controllers/origami/split_bill_controller.rb | 13 +++++++++---- app/views/origami/split_bill/index.html.erb | 5 ++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/controllers/origami/split_bill_controller.rb b/app/controllers/origami/split_bill_controller.rb index 59cdae1e..e9698da6 100644 --- a/app/controllers/origami/split_bill_controller.rb +++ b/app/controllers/origami/split_bill_controller.rb @@ -49,10 +49,15 @@ class Origami::SplitBillController < BaseOrigamiController end end else - puts "new booking" - puts "new order" - puts "update order_id in order" - puts "do process" + if params[:type] == "Table" + type = "TableBooking" + else + type = "RoomBooking" + end + + booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type, + :checkin_at => Time.now.utc, :checkin_by => current_user.name, + :booking_status => "assign" }) end # Bind shift sale id to sale diff --git a/app/views/origami/split_bill/index.html.erb b/app/views/origami/split_bill/index.html.erb index c96e2674..e776dacf 100755 --- a/app/views/origami/split_bill/index.html.erb +++ b/app/views/origami/split_bill/index.html.erb @@ -15,6 +15,7 @@
+

Order No: <%=@order.order_id rescue ' '%>

@@ -167,6 +168,8 @@ /* function for split bill process */ function splitBillProcess(cnt_items){ + var dining_id = $("#table_id").text(); + var type = $("#table_type").text(); var order_items = get_selected_order_items();// Selected Order Items var json_booking = JSON.parse('<%= @booking.to_json.html_safe %>'); var booking_id = ""; @@ -179,7 +182,7 @@ function splitBillProcess(cnt_items){ type: "POST", url: ajax_url, dataType: 'JSON', - data: {'booking_id' : booking_id, 'order_items' : JSON.stringify(order_items)}, + data: {'dining_id' : dining_id, 'type': type, 'booking_id' : booking_id, 'order_items' : JSON.stringify(order_items)}, success: function (result) { if (!result.status) { swal("Information!", result.error_message); From 65d9f0fb6f65494e0b09d2cc040abfdda0ba1faf Mon Sep 17 00:00:00 2001 From: phyusin Date: Mon, 5 Feb 2018 13:07:30 +0630 Subject: [PATCH 05/15] order update --- .../origami/split_bill_controller.rb | 33 +++++++++++++++++++ app/views/origami/split_bill/index.html.erb | 3 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/app/controllers/origami/split_bill_controller.rb b/app/controllers/origami/split_bill_controller.rb index e9698da6..3fa36f7d 100644 --- a/app/controllers/origami/split_bill_controller.rb +++ b/app/controllers/origami/split_bill_controller.rb @@ -58,6 +58,39 @@ class Origami::SplitBillController < BaseOrigamiController booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type, :checkin_at => Time.now.utc, :checkin_by => current_user.name, :booking_status => "assign" }) + + customer = Customer.find(params[:customer_id]) + order_type = "dine_in" + if !customer.nil? + if customer.customer_type == "Takeaway" + order_type = "takeaway" + elsif customer.customer_type == "Delivery" + order_type = "delivery" + end + end + # begin + order = Order.new + order.date = Time.now.utc + order.source = "cashier" + order.order_type = order_type + order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile + order.item_count = order_items.count + order.status = "new" + order.table_id = params[:dining_id] # this is dining facilities's id + order.waiters = current_user.name + order.employee_name = current_user.name + order.guest_info = nil + order.save + + order_items.each do |order_item| + orderItem = OrderItem.find(order_item.order_items_id) + orderItem.order_id = order.order_id + orderItem.save + end + + sale = Sale.new + status, sale_id = sale.generate_invoice_from_booking(params[:booking_id], current_user, get_cashier_by_terminal) + sale_data = Sale.find_by_sale_id(sale_id) end # Bind shift sale id to sale diff --git a/app/views/origami/split_bill/index.html.erb b/app/views/origami/split_bill/index.html.erb index e776dacf..6057077e 100755 --- a/app/views/origami/split_bill/index.html.erb +++ b/app/views/origami/split_bill/index.html.erb @@ -170,6 +170,7 @@ function splitBillProcess(cnt_items){ var dining_id = $("#table_id").text(); var type = $("#table_type").text(); + var customer_id = $("#customer_id").text(); var order_items = get_selected_order_items();// Selected Order Items var json_booking = JSON.parse('<%= @booking.to_json.html_safe %>'); var booking_id = ""; @@ -182,7 +183,7 @@ function splitBillProcess(cnt_items){ type: "POST", url: ajax_url, dataType: 'JSON', - data: {'dining_id' : dining_id, 'type': type, 'booking_id' : booking_id, 'order_items' : JSON.stringify(order_items)}, + data: {'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_items' : JSON.stringify(order_items)}, success: function (result) { if (!result.status) { swal("Information!", result.error_message); From 07807443776242eab2aa0066762c279dbba40a3a Mon Sep 17 00:00:00 2001 From: phyusin Date: Mon, 5 Feb 2018 16:57:46 +0630 Subject: [PATCH 06/15] check booking with order item split --- app/controllers/origami/split_bill_controller.rb | 6 ++++-- app/models/sale_payment.rb | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/origami/split_bill_controller.rb b/app/controllers/origami/split_bill_controller.rb index 3fa36f7d..96caf298 100644 --- a/app/controllers/origami/split_bill_controller.rb +++ b/app/controllers/origami/split_bill_controller.rb @@ -82,14 +82,16 @@ class Origami::SplitBillController < BaseOrigamiController order.guest_info = nil order.save + BookingOrder.create({:booking_id => booking.booking_id, :order_id => order.order_id}) + order_items.each do |order_item| - orderItem = OrderItem.find(order_item.order_items_id) + orderItem = OrderItem.find(order_item["id"]) orderItem.order_id = order.order_id orderItem.save end sale = Sale.new - status, sale_id = sale.generate_invoice_from_booking(params[:booking_id], current_user, get_cashier_by_terminal) + status, sale_id = sale.generate_invoice_from_booking(booking.booking_id, current_user, get_cashier_by_terminal) sale_data = Sale.find_by_sale_id(sale_id) end diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index ed1b9170..eb7e3e94 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -398,6 +398,7 @@ class SalePayment < ApplicationRecord end else status = false + sale_count += 1 end end end From 3f247f731eac607fbdf45ae9fb83779b99e8890f Mon Sep 17 00:00:00 2001 From: San Wai Lwin Date: Mon, 5 Feb 2018 18:11:45 +0630 Subject: [PATCH 07/15] Shop name in navbar,linke to shop info --- Gemfile.lock | 60 +++++++++---------- app/assets/stylesheets/origami.scss | 2 +- app/assets/stylesheets/reset.css | 9 +++ app/controllers/application_controller.rb | 6 +- app/controllers/crm/bookings_controller.rb | 7 ++- app/controllers/crm/customers_controller.rb | 6 ++ .../crm/dining_queues_controller.rb | 6 ++ app/controllers/crm/home_controller.rb | 7 ++- app/controllers/oqs/backhome_controller.rb | 11 ++++ app/controllers/oqs/edit_controller.rb | 6 ++ app/controllers/oqs/home_controller.rb | 6 ++ app/controllers/oqs/print_controller.rb | 6 ++ .../origami/addorders_controller.rb | 5 ++ .../origami/bank_integration_controller.rb | 6 ++ .../origami/card_payments_controller.rb | 5 ++ .../origami/cash_ins_controller.rb | 6 ++ .../origami/cash_mgmt_controller.rb | 6 ++ .../origami/cash_outs_controller.rb | 6 ++ .../origami/check_in_process_controller.rb | 6 ++ .../origami/credit_payments_controller.rb | 6 ++ .../origami/customers_controller.rb | 6 +- .../origami/discounts_controller.rb | 6 +- app/controllers/origami/home_controller.rb | 5 ++ app/controllers/origami/home_controller_bk.rb | 5 ++ .../origami/in_duties_controller.rb | 6 ++ app/controllers/origami/jcb_controller.rb | 5 ++ app/controllers/origami/master_controller.rb | 5 ++ .../origami/moveroom_controller.rb | 6 ++ .../origami/movetable_controller.rb | 6 ++ app/controllers/origami/mpu_controller.rb | 5 ++ app/controllers/origami/orders_controller.rb | 6 ++ .../origami/other_charges_controller.rb | 6 ++ .../origami/others_payments_controller.rb | 5 ++ .../origami/payments_controller.rb | 6 ++ .../origami/paypar_payments_controller.rb | 6 ++ .../origami/product_commissions_controller.rb | 6 ++ .../origami/redeem_payments_controller.rb | 6 ++ .../origami/request_bills_controller.rb | 6 ++ .../origami/room_invoices_controller.rb | 5 ++ app/controllers/origami/rooms_controller.rb | 6 +- .../origami/sale_edit_controller.rb | 6 ++ app/controllers/origami/sales_controller.rb | 6 +- app/controllers/origami/shifts_controller.rb | 5 ++ app/controllers/origami/surveys_controller.rb | 6 ++ .../origami/table_invoices_controller.rb | 5 ++ .../origami/unionpay_controller.rb | 6 ++ app/controllers/origami/visa_controller.rb | 5 ++ app/controllers/origami/void_controller.rb | 6 ++ app/controllers/origami/voucher_controller.rb | 5 ++ .../reports/bksaleitem_controller.rb | 6 ++ .../reports/commission_controller.rb | 6 ++ .../reports/credit_payment_controller.rb | 6 ++ .../reports/dailysale_controller.rb | 6 ++ .../reports/payment_method_controller.rb | 6 ++ .../reports/receipt_no_controller.rb | 6 ++ .../reports/saleitem_controller.rb | 7 ++- .../reports/shiftsale_controller.rb | 6 ++ .../reports/stock_check_controller.rb | 6 ++ .../reports/void_sale_controller.rb | 6 ++ app/models/ability.rb | 7 ++- app/views/layouts/_header.html.erb | 21 ++++++- app/views/layouts/_left_sidebar.html.erb | 18 +++--- app/views/layouts/login_dashboard.html.erb | 2 +- app/views/origami/home/show.html.erb | 5 +- 64 files changed, 400 insertions(+), 55 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1c7e6534..899a471a 100755 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -53,7 +53,7 @@ GEM bcrypt (3.1.11) bindex (0.5.0) builder (3.2.3) - byebug (9.1.0) + byebug (10.0.0) cancancan (1.17.0) capistrano (3.10.1) airbrussh (>= 1.0.0) @@ -66,7 +66,7 @@ GEM capistrano-rails (1.3.1) capistrano (~> 3.1) capistrano-bundler (~> 1.1) - carrierwave (1.2.1) + carrierwave (1.2.2) activemodel (>= 4.0.0) activesupport (>= 4.0.0) mime-types (>= 1.16) @@ -81,7 +81,7 @@ GEM coffee-script-source (1.12.2) concurrent-ruby (1.0.5) connection_pool (2.2.1) - crass (1.0.2) + crass (1.0.3) cups (0.1.10) database_cleaner (1.6.2) diff-lcs (1.3) @@ -92,17 +92,17 @@ GEM factory_girl_rails (4.9.0) factory_girl (~> 4.9.0) railties (>= 3.0.0) - faker (1.8.4) - i18n (~> 0.5) + faker (1.8.7) + i18n (>= 0.7) ffi (1.9.18) - filterrific (2.1.2) - font-awesome-rails (4.7.0.2) + filterrific (5.0.1) + font-awesome-rails (4.7.0.3) railties (>= 3.2, < 5.2) globalid (0.4.1) activesupport (>= 4.2.0) httparty (0.15.6) multi_xml (>= 0.5.2) - i18n (0.9.1) + i18n (0.9.3) concurrent-ruby (~> 1.0) jbuilder (2.7.0) activesupport (>= 4.2.0) @@ -142,32 +142,32 @@ GEM mini_magick (4.8.0) mini_mime (1.0.0) mini_portile2 (2.3.0) - minitest (5.10.3) + minitest (5.11.3) momentjs-rails (2.17.1) railties (>= 3.1) - multi_json (1.12.2) + multi_json (1.13.1) multi_xml (0.6.0) - mysql2 (0.4.9) + mysql2 (0.4.10) nested_form (0.3.2) net-scp (1.2.1) net-ssh (>= 2.6.5) net-ssh (4.2.0) - nio4r (2.1.0) - nokogiri (1.8.1) + nio4r (2.2.0) + nokogiri (1.8.2) mini_portile2 (~> 2.3.0) pdf-core (0.7.0) - pg (0.21.0) + pg (1.0.0) prawn (2.2.2) pdf-core (~> 0.7.0) ttfunk (~> 1.5) prawn-table (0.2.2) prawn (>= 1.3.0, < 3.0.0) - puma (3.10.0) - rack (2.0.3) + puma (3.11.2) + rack (2.0.4) rack-cors (1.0.2) rack-protection (2.0.0) rack - rack-test (0.7.0) + rack-test (0.8.2) rack (>= 1.0, < 3) rails (5.1.4) actioncable (= 5.1.4) @@ -192,12 +192,12 @@ GEM method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (12.2.1) + rake (12.3.0) rb-fsevent (0.10.2) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) redis (3.3.5) - rspec-core (3.7.0) + rspec-core (3.7.1) rspec-support (~> 3.7.0) rspec-expectations (3.7.0) diff-lcs (>= 1.2.0, < 2.0) @@ -205,7 +205,7 @@ GEM rspec-mocks (3.7.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.7.0) - rspec-rails (3.7.1) + rspec-rails (3.7.2) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) @@ -213,14 +213,14 @@ GEM rspec-expectations (~> 3.7.0) rspec-mocks (~> 3.7.0) rspec-support (~> 3.7.0) - rspec-support (3.7.0) + rspec-support (3.7.1) ruby-ole (1.2.12.1) - sass (3.5.3) + sass (3.5.5) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.0.6) + sass-rails (5.0.7) railties (>= 4.0.0, < 6) sass (~> 3.1) sprockets (>= 2.8, < 4.0) @@ -238,7 +238,7 @@ GEM simple_form (3.5.0) actionpack (> 4, < 5.2) activemodel (> 4, < 5.2) - spreadsheet (1.1.4) + spreadsheet (1.1.5) ruby-ole (>= 1.0) spring (2.0.2) activesupport (>= 4.2) @@ -263,12 +263,12 @@ GEM to_xls-rails (1.3.1) spreadsheet (>= 0.8.5) ttfunk (1.5.1) - turbolinks (5.0.1) - turbolinks-source (~> 5) - turbolinks-source (5.0.3) + turbolinks (5.1.0) + turbolinks-source (~> 5.1) + turbolinks-source (5.1.0) tzinfo (1.2.4) thread_safe (~> 0.1) - uglifier (3.2.0) + uglifier (4.1.5) execjs (>= 0.3.0, < 3) web-console (3.5.1) actionview (>= 5.0) @@ -277,8 +277,8 @@ GEM railties (>= 5.0) websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.2) - whenever (0.9.7) + websocket-extensions (0.1.3) + whenever (0.10.0) chronic (>= 0.6.3) PLATFORMS diff --git a/app/assets/stylesheets/origami.scss b/app/assets/stylesheets/origami.scss index 30d8a090..0e67c57e 100755 --- a/app/assets/stylesheets/origami.scss +++ b/app/assets/stylesheets/origami.scss @@ -134,7 +134,7 @@ select.form-control { } .credit-color{ - background-color:#FF5722; + background-color:#FFA500; } .other-payment-color{ diff --git a/app/assets/stylesheets/reset.css b/app/assets/stylesheets/reset.css index ea0aaa4f..78f23e15 100644 --- a/app/assets/stylesheets/reset.css +++ b/app/assets/stylesheets/reset.css @@ -68,6 +68,15 @@ background-color: #ccc; } +/*Shop Info color in navbar*/ +.shopinfo { + color: #212529; +} + +.link-buttoon { + text-decoration: none; +} + @media (min-width: 768px){ .dropdown-menu { padding: .3rem 0; diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e66d7700..3a35a15b 100755 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -6,7 +6,7 @@ class ApplicationController < ActionController::Base # lookup domain for db from provision before_action :lookup_domain, :set_locale - helper_method :current_company,:current_login_employee,:current_user + helper_method :current_company,:current_login_employee,:current_user,:shop_detail # alias_method :current_user, :current_login_employee,:current_user #this is base api base controller to need to inherit. #all token authentication must be done here @@ -101,6 +101,10 @@ class ApplicationController < ActionController::Base end + def shop_detail + @shop = Shop.first + end + def current_login_employee if (!session[:session_token].nil?) @employee = Employee.find_by_token_session(session[:session_token]) diff --git a/app/controllers/crm/bookings_controller.rb b/app/controllers/crm/bookings_controller.rb index efaa5419..30a9eb92 100755 --- a/app/controllers/crm/bookings_controller.rb +++ b/app/controllers/crm/bookings_controller.rb @@ -14,5 +14,10 @@ class Crm::BookingsController < BaseCrmController end end - + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index f917538e..12944632 100755 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -398,4 +398,10 @@ end params.require(:customer).permit(:id, :name, :company, :contact_no, :email, :date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type) end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/crm/dining_queues_controller.rb b/app/controllers/crm/dining_queues_controller.rb index 8184c660..4b1eddcc 100755 --- a/app/controllers/crm/dining_queues_controller.rb +++ b/app/controllers/crm/dining_queues_controller.rb @@ -142,4 +142,10 @@ class Crm::DiningQueuesController < BaseCrmController def dining_queue_params params.require(:dining_queue).permit(:customer_id, :name, :contact_no, :queue_no,:status,:seater,:remark) end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/crm/home_controller.rb b/app/controllers/crm/home_controller.rb index 13b4ede3..b5acf59a 100755 --- a/app/controllers/crm/home_controller.rb +++ b/app/controllers/crm/home_controller.rb @@ -55,6 +55,11 @@ class Crm::HomeController < BaseCrmController # end # end - + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/oqs/backhome_controller.rb b/app/controllers/oqs/backhome_controller.rb index 4ac5f0a2..990fa459 100755 --- a/app/controllers/oqs/backhome_controller.rb +++ b/app/controllers/oqs/backhome_controller.rb @@ -30,6 +30,12 @@ class Oqs::HomeController < BaseOqsController @queue_stations_items end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end + # Get Order items def get_order_items items = [] @@ -123,4 +129,9 @@ class Oqs::HomeController < BaseOqsController # completed_order = AssignedOrderItem.group(:order_id).where('delivery_status=true'); end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb index 01372dd3..b924702e 100755 --- a/app/controllers/oqs/edit_controller.rb +++ b/app/controllers/oqs/edit_controller.rb @@ -48,4 +48,10 @@ class Oqs::EditController < BaseOqsController order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Updated)" ) end end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/oqs/home_controller.rb b/app/controllers/oqs/home_controller.rb index 3ee71e8d..5ecd6920 100755 --- a/app/controllers/oqs/home_controller.rb +++ b/app/controllers/oqs/home_controller.rb @@ -209,4 +209,10 @@ class Oqs::HomeController < BaseOqsController end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end + end diff --git a/app/controllers/oqs/print_controller.rb b/app/controllers/oqs/print_controller.rb index aaa6b262..c78dbc10 100755 --- a/app/controllers/oqs/print_controller.rb +++ b/app/controllers/oqs/print_controller.rb @@ -101,4 +101,10 @@ class Oqs::PrintController < ApplicationController end end end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end \ No newline at end of file diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb index af404d8b..400cffa5 100755 --- a/app/controllers/origami/addorders_controller.rb +++ b/app/controllers/origami/addorders_controller.rb @@ -179,4 +179,9 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController # @dining = DiningFacility.find(params[:id]) # end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/bank_integration_controller.rb b/app/controllers/origami/bank_integration_controller.rb index a5e5d59f..6dde10da 100644 --- a/app/controllers/origami/bank_integration_controller.rb +++ b/app/controllers/origami/bank_integration_controller.rb @@ -95,4 +95,10 @@ class Origami::BankIntegrationController < ApplicationController #BaseOrigamiCon end render json: response end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/card_payments_controller.rb b/app/controllers/origami/card_payments_controller.rb index e0c56971..cd08c16a 100755 --- a/app/controllers/origami/card_payments_controller.rb +++ b/app/controllers/origami/card_payments_controller.rb @@ -24,4 +24,9 @@ class Origami::CardPaymentsController < BaseOrigamiController def create end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/cash_ins_controller.rb b/app/controllers/origami/cash_ins_controller.rb index 36860b85..4d7c2b64 100755 --- a/app/controllers/origami/cash_ins_controller.rb +++ b/app/controllers/origami/cash_ins_controller.rb @@ -14,4 +14,10 @@ class Origami::CashInsController < BaseOrigamiController shift.cash_in = shift.cash_in + amount.to_i shift.save end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/cash_mgmt_controller.rb b/app/controllers/origami/cash_mgmt_controller.rb index aaf55c1f..1f48370e 100755 --- a/app/controllers/origami/cash_mgmt_controller.rb +++ b/app/controllers/origami/cash_mgmt_controller.rb @@ -7,4 +7,10 @@ class Origami::CashMgmtController < ApplicationController def create end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/cash_outs_controller.rb b/app/controllers/origami/cash_outs_controller.rb index 048e78b4..cc22516c 100755 --- a/app/controllers/origami/cash_outs_controller.rb +++ b/app/controllers/origami/cash_outs_controller.rb @@ -12,4 +12,10 @@ class Origami::CashOutsController < BaseOrigamiController shift.cash_out = shift.cash_out + amount.to_i shift.save end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/check_in_process_controller.rb b/app/controllers/origami/check_in_process_controller.rb index 2c5b0b38..48d55c9a 100644 --- a/app/controllers/origami/check_in_process_controller.rb +++ b/app/controllers/origami/check_in_process_controller.rb @@ -35,4 +35,10 @@ class Origami::CheckInProcessController < BaseOrigamiController format.json { render json: respond } end end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/credit_payments_controller.rb b/app/controllers/origami/credit_payments_controller.rb index 404b1506..cddf4feb 100755 --- a/app/controllers/origami/credit_payments_controller.rb +++ b/app/controllers/origami/credit_payments_controller.rb @@ -46,4 +46,10 @@ class Origami::CreditPaymentsController < BaseOrigamiController end end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end + end diff --git a/app/controllers/origami/customers_controller.rb b/app/controllers/origami/customers_controller.rb index d84dac92..be1cc4dd 100755 --- a/app/controllers/origami/customers_controller.rb +++ b/app/controllers/origami/customers_controller.rb @@ -130,5 +130,9 @@ class Origami::CustomersController < BaseOrigamiController end end - + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/discounts_controller.rb b/app/controllers/origami/discounts_controller.rb index 1166a705..4c7555b8 100755 --- a/app/controllers/origami/discounts_controller.rb +++ b/app/controllers/origami/discounts_controller.rb @@ -289,5 +289,9 @@ class Origami::DiscountsController < BaseOrigamiController # redirect_to origami_path(sale_id) # end - + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index c00b39bf..cc8aaaef 100755 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -96,4 +96,9 @@ def set_dining @dining = DiningFacility.find(params[:dining_id]) end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/home_controller_bk.rb b/app/controllers/origami/home_controller_bk.rb index 4839f15c..3e414665 100755 --- a/app/controllers/origami/home_controller_bk.rb +++ b/app/controllers/origami/home_controller_bk.rb @@ -81,4 +81,9 @@ class Origami::HomeController < ApplicationController end end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/in_duties_controller.rb b/app/controllers/origami/in_duties_controller.rb index 5607939a..945f3bd9 100755 --- a/app/controllers/origami/in_duties_controller.rb +++ b/app/controllers/origami/in_duties_controller.rb @@ -168,4 +168,10 @@ class Origami::InDutiesController < BaseOrigamiController def in_duty_params params.require(:in_duty).permit(:id, :dinning_id, :commissioner_ids, :in_time, :out_time) end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/jcb_controller.rb b/app/controllers/origami/jcb_controller.rb index b8c7e7e0..e0e8e233 100755 --- a/app/controllers/origami/jcb_controller.rb +++ b/app/controllers/origami/jcb_controller.rb @@ -58,4 +58,9 @@ class Origami::JcbController < BaseOrigamiController end end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/master_controller.rb b/app/controllers/origami/master_controller.rb index b3813577..3d08bcfa 100755 --- a/app/controllers/origami/master_controller.rb +++ b/app/controllers/origami/master_controller.rb @@ -57,4 +57,9 @@ class Origami::MasterController < BaseOrigamiController end end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/moveroom_controller.rb b/app/controllers/origami/moveroom_controller.rb index 47a9fec9..5b53f68c 100755 --- a/app/controllers/origami/moveroom_controller.rb +++ b/app/controllers/origami/moveroom_controller.rb @@ -36,4 +36,10 @@ class Origami::MoveroomController < BaseOrigamiController end end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end + end diff --git a/app/controllers/origami/movetable_controller.rb b/app/controllers/origami/movetable_controller.rb index 52780381..8da417ac 100755 --- a/app/controllers/origami/movetable_controller.rb +++ b/app/controllers/origami/movetable_controller.rb @@ -70,4 +70,10 @@ class Origami::MovetableController < BaseOrigamiController @get_type = Booking.update_dining_facility(booking_array,change_to,change_from) end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/mpu_controller.rb b/app/controllers/origami/mpu_controller.rb index 7b7ef5a0..7709734d 100755 --- a/app/controllers/origami/mpu_controller.rb +++ b/app/controllers/origami/mpu_controller.rb @@ -57,4 +57,9 @@ class Origami::MpuController < BaseOrigamiController end end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/orders_controller.rb b/app/controllers/origami/orders_controller.rb index 85047ef0..c2670184 100755 --- a/app/controllers/origami/orders_controller.rb +++ b/app/controllers/origami/orders_controller.rb @@ -13,4 +13,10 @@ class Origami::OrdersController < BaseOrigamiController end end end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/other_charges_controller.rb b/app/controllers/origami/other_charges_controller.rb index 51a1f7db..6cb9fbf9 100755 --- a/app/controllers/origami/other_charges_controller.rb +++ b/app/controllers/origami/other_charges_controller.rb @@ -57,4 +57,10 @@ class Origami::OtherChargesController < BaseOrigamiController dining = {:table_id => table_id, :table_type => table.type } render :json => dining.to_json end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end \ No newline at end of file diff --git a/app/controllers/origami/others_payments_controller.rb b/app/controllers/origami/others_payments_controller.rb index 16c7edae..6b034ed3 100755 --- a/app/controllers/origami/others_payments_controller.rb +++ b/app/controllers/origami/others_payments_controller.rb @@ -36,4 +36,9 @@ class Origami::OthersPaymentsController < BaseOrigamiController def create end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 6fa61bc7..e65d9550 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -366,4 +366,10 @@ class Origami::PaymentsController < BaseOrigamiController end end end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end \ No newline at end of file diff --git a/app/controllers/origami/paypar_payments_controller.rb b/app/controllers/origami/paypar_payments_controller.rb index 5a15aa8c..9b23a12f 100755 --- a/app/controllers/origami/paypar_payments_controller.rb +++ b/app/controllers/origami/paypar_payments_controller.rb @@ -27,4 +27,10 @@ class Origami::PayparPaymentsController < BaseOrigamiController end end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/product_commissions_controller.rb b/app/controllers/origami/product_commissions_controller.rb index 74dd8095..2ab9a618 100755 --- a/app/controllers/origami/product_commissions_controller.rb +++ b/app/controllers/origami/product_commissions_controller.rb @@ -136,4 +136,10 @@ class Origami::ProductCommissionsController < BaseOrigamiController def product_commission_params params.fetch(:product_commission, {}) end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/redeem_payments_controller.rb b/app/controllers/origami/redeem_payments_controller.rb index 2fdedf32..56fcb738 100755 --- a/app/controllers/origami/redeem_payments_controller.rb +++ b/app/controllers/origami/redeem_payments_controller.rb @@ -67,4 +67,10 @@ class Origami::RedeemPaymentsController < BaseOrigamiController end @out = false, 0 end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index e0f1d06c..c076a820 100755 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -55,4 +55,10 @@ class Origami::RequestBillsController < ApplicationController # printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts,member_info,shop_details) end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/room_invoices_controller.rb b/app/controllers/origami/room_invoices_controller.rb index 8d805771..9c3b16a6 100755 --- a/app/controllers/origami/room_invoices_controller.rb +++ b/app/controllers/origami/room_invoices_controller.rb @@ -37,4 +37,9 @@ class Origami::RoomInvoicesController < BaseOrigamiController @customer = @sale.customer end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/rooms_controller.rb b/app/controllers/origami/rooms_controller.rb index bd375d63..13769860 100755 --- a/app/controllers/origami/rooms_controller.rb +++ b/app/controllers/origami/rooms_controller.rb @@ -92,5 +92,9 @@ class Origami::RoomsController < BaseOrigamiController # end end - + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/sale_edit_controller.rb b/app/controllers/origami/sale_edit_controller.rb index c00c35f0..a4b50689 100755 --- a/app/controllers/origami/sale_edit_controller.rb +++ b/app/controllers/origami/sale_edit_controller.rb @@ -160,4 +160,10 @@ class Origami::SaleEditController < BaseOrigamiController ProductCommission.remove_product_commission(item) end end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/sales_controller.rb b/app/controllers/origami/sales_controller.rb index bdf481c2..e57d2ca0 100755 --- a/app/controllers/origami/sales_controller.rb +++ b/app/controllers/origami/sales_controller.rb @@ -51,5 +51,9 @@ class Origami::SalesController < BaseOrigamiController end end - + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/shifts_controller.rb b/app/controllers/origami/shifts_controller.rb index cb2cc830..435a98d1 100755 --- a/app/controllers/origami/shifts_controller.rb +++ b/app/controllers/origami/shifts_controller.rb @@ -108,4 +108,9 @@ class Origami::ShiftsController < BaseOrigamiController end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/surveys_controller.rb b/app/controllers/origami/surveys_controller.rb index b1baa0a8..90ff4c08 100644 --- a/app/controllers/origami/surveys_controller.rb +++ b/app/controllers/origami/surveys_controller.rb @@ -37,4 +37,10 @@ class Origami::SurveysController < BaseOrigamiController def survey_params params.require(:survey).permit(:child, :adult,:male,:female,:local,:foreigner, :dining_name,:receipt_no,:shift_id,:created_by,:total_customer,:total_amount) end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/table_invoices_controller.rb b/app/controllers/origami/table_invoices_controller.rb index 655083df..a9d5d340 100755 --- a/app/controllers/origami/table_invoices_controller.rb +++ b/app/controllers/origami/table_invoices_controller.rb @@ -61,4 +61,9 @@ class Origami::TableInvoicesController < BaseOrigamiController @customer = @sale.customer end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/unionpay_controller.rb b/app/controllers/origami/unionpay_controller.rb index fc15b7f5..813f4eb5 100644 --- a/app/controllers/origami/unionpay_controller.rb +++ b/app/controllers/origami/unionpay_controller.rb @@ -58,4 +58,10 @@ class Origami::UnionpayController < BaseOrigamiController @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "unionpay") end end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/visa_controller.rb b/app/controllers/origami/visa_controller.rb index b872aec3..8bdd8a90 100755 --- a/app/controllers/origami/visa_controller.rb +++ b/app/controllers/origami/visa_controller.rb @@ -57,4 +57,9 @@ class Origami::VisaController < BaseOrigamiController end end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/void_controller.rb b/app/controllers/origami/void_controller.rb index 52b2068c..f9ad89a4 100755 --- a/app/controllers/origami/void_controller.rb +++ b/app/controllers/origami/void_controller.rb @@ -112,4 +112,10 @@ class Origami::VoidController < BaseOrigamiController end end end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end \ No newline at end of file diff --git a/app/controllers/origami/voucher_controller.rb b/app/controllers/origami/voucher_controller.rb index c4b3c840..750189df 100755 --- a/app/controllers/origami/voucher_controller.rb +++ b/app/controllers/origami/voucher_controller.rb @@ -78,4 +78,9 @@ class Origami::VoucherController < BaseOrigamiController end end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/reports/bksaleitem_controller.rb b/app/controllers/reports/bksaleitem_controller.rb index 0f91681d..118269bb 100755 --- a/app/controllers/reports/bksaleitem_controller.rb +++ b/app/controllers/reports/bksaleitem_controller.rb @@ -16,4 +16,10 @@ class Reports::SaleitemController < BaseReportController end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end + end diff --git a/app/controllers/reports/commission_controller.rb b/app/controllers/reports/commission_controller.rb index e97a1a77..9e13bd75 100755 --- a/app/controllers/reports/commission_controller.rb +++ b/app/controllers/reports/commission_controller.rb @@ -49,5 +49,11 @@ class Reports::CommissionController < BaseReportController format.json { render json: out } end end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/reports/credit_payment_controller.rb b/app/controllers/reports/credit_payment_controller.rb index 3b716cc2..abf7a6af 100755 --- a/app/controllers/reports/credit_payment_controller.rb +++ b/app/controllers/reports/credit_payment_controller.rb @@ -59,4 +59,10 @@ authorize_resource :class => false format.json { render json: out } end end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end \ No newline at end of file diff --git a/app/controllers/reports/dailysale_controller.rb b/app/controllers/reports/dailysale_controller.rb index e2102d87..d43355fa 100755 --- a/app/controllers/reports/dailysale_controller.rb +++ b/app/controllers/reports/dailysale_controller.rb @@ -19,4 +19,10 @@ class Reports::DailysaleController < BaseReportController def show end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/reports/payment_method_controller.rb b/app/controllers/reports/payment_method_controller.rb index 01a904ae..0262594f 100644 --- a/app/controllers/reports/payment_method_controller.rb +++ b/app/controllers/reports/payment_method_controller.rb @@ -61,4 +61,10 @@ class Reports::PaymentMethodController < BaseReportController format.json { render json: out } end end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end \ No newline at end of file diff --git a/app/controllers/reports/receipt_no_controller.rb b/app/controllers/reports/receipt_no_controller.rb index faa12eae..ead85d72 100755 --- a/app/controllers/reports/receipt_no_controller.rb +++ b/app/controllers/reports/receipt_no_controller.rb @@ -61,4 +61,10 @@ authorize_resource :class => false format.json { render json: out } end end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end \ No newline at end of file diff --git a/app/controllers/reports/saleitem_controller.rb b/app/controllers/reports/saleitem_controller.rb index a9d23797..58421342 100755 --- a/app/controllers/reports/saleitem_controller.rb +++ b/app/controllers/reports/saleitem_controller.rb @@ -76,5 +76,10 @@ class Reports::SaleitemController < BaseReportController format.json { render json: out } end end - + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/reports/shiftsale_controller.rb b/app/controllers/reports/shiftsale_controller.rb index f9373374..cf722495 100755 --- a/app/controllers/reports/shiftsale_controller.rb +++ b/app/controllers/reports/shiftsale_controller.rb @@ -47,5 +47,11 @@ class Reports::ShiftsaleController < BaseReportController format.json { render json: out } end end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/reports/stock_check_controller.rb b/app/controllers/reports/stock_check_controller.rb index a9188f5d..9a033956 100755 --- a/app/controllers/reports/stock_check_controller.rb +++ b/app/controllers/reports/stock_check_controller.rb @@ -46,5 +46,11 @@ class Reports::StockCheckController < BaseReportController format.json { render json: out } end end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/reports/void_sale_controller.rb b/app/controllers/reports/void_sale_controller.rb index 6169dadc..50a7c57d 100755 --- a/app/controllers/reports/void_sale_controller.rb +++ b/app/controllers/reports/void_sale_controller.rb @@ -58,4 +58,10 @@ authorize_resource :class => false format.json { render json: out } end end + + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end \ No newline at end of file diff --git a/app/models/ability.rb b/app/models/ability.rb index a72a47d2..1d310367 100755 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -102,7 +102,9 @@ class Ability can :menage, Booking can :manage, OrderQueueStation can :read, Sale - can :update, Sale + can :update, Sale + + can :manage, Customer can :get_customer, Customer can :add_customer, Customer can :update_sale_by_customer, Customer @@ -126,12 +128,11 @@ class Ability can :move_dining, :moveroom - can :manage, DiningQueue - can :manage, Commission can :manage, Commissioner can :manage, Promotion can :manage, Product + elsif user.role == "account" diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 67746ba6..babc6e06 100755 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -25,6 +25,13 @@
+ + + @@ -61,6 +66,11 @@ <% end %>
<%= table.name %> + <% if !@order_items_count.nil? %> + <% if @order_items_count.key?(table.id) %> + (Orders : <%= @order_items_count[table.id] %>) + <% end %> + <% end %> new
@@ -87,6 +97,11 @@
<%= room.name %> + <% if !@order_items_count.nil? %> + <% if @order_items_count.key?(room.id) %> + (Orders : <%= @order_items_count[room.id] %>) + <% end %> + <% end %> billed
@@ -95,6 +110,11 @@
<%= room.name %> + <% if !@order_items_count.nil? %> + <% if @order_items_count.key?(room.id) %> + (Orders : <%= @order_items_count[room.id] %>) + <% end %> + <% end %> new
diff --git a/config/locales/en.yml b/config/locales/en.yml index 6bc0271e..d4dc8005 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -70,6 +70,7 @@ en: sale_audits: "Sale Audits" bottom: "Bottom" payment: "Payment" + backend: "Backend" views: btn: diff --git a/config/locales/mm.yml b/config/locales/mm.yml index 6bdb1768..2d35b1bf 100755 --- a/config/locales/mm.yml +++ b/config/locales/mm.yml @@ -65,6 +65,7 @@ mm: sale_audits: "အရောင်းပြင်ဆင်ခြင်းများ" bottom: "အရောင်းအနဲဆုံး" payment: "ငွေပေးချေမှု" + backend: "Backend" views: btn: diff --git a/config/schedule.rb b/config/schedule.rb index 17f336a0..4b3f6a3b 100755 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -11,5 +11,5 @@ every 30.minutes do end every 1.minutes do - runner "CheckinJob.perform" + runner "DiningFacility.checkin_time" end \ No newline at end of file From 4c563e23bfe6e4c4925a93f52ec09412cdcaa6fb Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 9 Feb 2018 14:19:53 +0630 Subject: [PATCH 15/15] add shop info in split bill --- app/controllers/origami/split_bill_controller.rb | 6 ++++++ app/views/layouts/_header.html.erb | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controllers/origami/split_bill_controller.rb b/app/controllers/origami/split_bill_controller.rb index d50c0cd4..9a27010d 100644 --- a/app/controllers/origami/split_bill_controller.rb +++ b/app/controllers/origami/split_bill_controller.rb @@ -206,4 +206,10 @@ class Origami::SplitBillController < BaseOrigamiController end end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end + end diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index babc6e06..ec0a3c68 100755 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -40,14 +40,16 @@ <% end %>