This commit is contained in:
Nweni
2017-06-04 10:12:33 +06:30
parent 47469cf466
commit e3e41bd64e
5 changed files with 17 additions and 8 deletions

View File

@@ -9,8 +9,8 @@ end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.0'
# Use mysql as the database for Active Record
gem 'mysql2', '>= 0.3.18', '< 0.5'
#gem 'pg'
#gem 'mysql2', '>= 0.3.18', '< 0.5'
gem 'pg'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets

View File

@@ -96,11 +96,11 @@ GEM
mini_portile2 (2.1.0)
minitest (5.10.2)
multi_json (1.12.1)
mysql2 (0.4.6)
nio4r (2.1.0)
nokogiri (1.7.2)
mini_portile2 (~> 2.1.0)
pdf-core (0.7.0)
pg (0.20.0)
prawn (2.2.2)
pdf-core (~> 0.7.0)
ttfunk (~> 1.5)
@@ -232,7 +232,7 @@ DEPENDENCIES
jbuilder (~> 2.5)
jquery-rails
listen (~> 3.0.5)
mysql2 (>= 0.3.18, < 0.5)
pg
prawn
prawn-table
puma (~> 3.0)

View File

@@ -0,0 +1,8 @@
class OrderBroadcastJob < ApplicationJob
queue_as :default
def perform(message)
order = Order.find(message) # message come as order_id
# ApplicationCable.server.broadcast "order_queue_station_channel", order: order
end
end

View File

@@ -211,7 +211,7 @@ class Order < ApplicationRecord
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
left join order_items on order_items.order_id = orders.id")
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true)
.group("orders.id")
.group("orders.id,order_items.id,dining_facilities.name")
end
#Origami: Cashier : to view order type Room
def self.get_order_rooms
@@ -222,7 +222,7 @@ class Order < ApplicationRecord
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
left join order_items on order_items.order_id = orders.id")
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,"dine_in",true)
.group("orders.id")
.group("orders.id,order_items.id,dining_facilities.name")
end
#Origami: Cashier : to view orders
def self.get_orders
@@ -233,6 +233,6 @@ class Order < ApplicationRecord
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
left join order_items on order_items.order_id = orders.id")
.where("dining_facilities.is_active=?",true)
.group("orders.id")
.group("orders.id,order_items.id,dining_facilities.name")
end
end

View File

@@ -37,6 +37,7 @@ class OrderItem < ApplicationRecord
def self.get_order_items_details(order_id)
order_details = OrderItem.select("order_items.item_name,order_items.qty,order_items.price,(order_items.qty*order_items.price) as total_price")
.joins("left join orders on orders.id = order_items.order_id")
.where("order_items.order_id=?",order_id)
.where("order_items.order_id=?",order_id)
end
end