update new request fixed
This commit is contained in:
@@ -4,8 +4,8 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
@webview = check_mobile
|
@webview = check_mobile
|
||||||
@tables = Table.all.active.order('status desc')
|
@tables = Table.unscoped.all.active.order('status desc')
|
||||||
@rooms = Room.all.active.order('status desc')
|
@rooms = Room.unscoped.all.active.order('status desc')
|
||||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||||
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||||
@shop = Shop.first
|
@shop = Shop.first
|
||||||
@@ -17,8 +17,8 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
def show
|
def show
|
||||||
@webview = check_mobile
|
@webview = check_mobile
|
||||||
|
|
||||||
@tables = Table.all.active.order('status desc')
|
@tables = Table.unscoped.all.active.order('status desc')
|
||||||
@rooms = Room.all.active.order('status desc')
|
@rooms = Room.unscoped.all.active.order('status desc')
|
||||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||||
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||||
|
|
||||||
@@ -29,9 +29,8 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@shop = Shop.first
|
@shop = Shop.first
|
||||||
@membership = MembershipSetting::MembershipSetting
|
@membership = MembershipSetting::MembershipSetting
|
||||||
@payment_methods = PaymentMethodSetting.all
|
@payment_methods = PaymentMethodSetting.all
|
||||||
|
|
||||||
@dining_booking = @dining.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.today.prev_day}' ")
|
@dining_booking = @dining.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.today.prev_day}' ")
|
||||||
|
#@dining_booking = @dining.bookings.active.where("created_at between '#{DateTime.now.utc - 12.hours}' and '#{DateTime.now.utc}'")
|
||||||
@dining_booking.each do |booking|
|
@dining_booking.each do |booking|
|
||||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||||
@order_items = Array.new
|
@order_items = Array.new
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class Origami::RoomsController < BaseOrigamiController
|
class Origami::RoomsController < BaseOrigamiController
|
||||||
def index
|
def index
|
||||||
@tables = Table.all.active.order('status desc')
|
@tables = Table.unscoped.all.active.order('status desc')
|
||||||
@rooms = Room.all.active.order('status desc')
|
@rooms = Room.unscoped.all.active.order('status desc')
|
||||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||||
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||||
# @shift = ShiftSale.current_open_shift(current_user.id)
|
# @shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
@@ -17,8 +17,8 @@ class Origami::RoomsController < BaseOrigamiController
|
|||||||
@webview = true
|
@webview = true
|
||||||
end
|
end
|
||||||
|
|
||||||
@tables = Table.all.active.order('status desc')
|
@tables = Table.unscoped.all.active.order('status desc')
|
||||||
@rooms = Room.all.active.order('status desc')
|
@rooms = Room.unscoped.all.active.order('status desc')
|
||||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||||
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||||
|
|
||||||
|
|||||||
@@ -180,4 +180,13 @@ class DiningFacility < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_current_booking_status
|
||||||
|
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}'").limit(1) #and checkout_at is null
|
||||||
|
if booking.count > 0 then
|
||||||
|
return booking[0]
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,21 +6,25 @@ if @zones
|
|||||||
#List all tables
|
#List all tables
|
||||||
json.tables zone.tables do |table|
|
json.tables zone.tables do |table|
|
||||||
if table.is_active
|
if table.is_active
|
||||||
|
booking = table.get_current_booking_status
|
||||||
json.id table.id
|
json.id table.id
|
||||||
json.name table.name
|
json.name table.name
|
||||||
json.status table.status
|
json.status table.status
|
||||||
json.zone_id table.zone_id #Add this zone_id to keep data structure consistance
|
json.zone_id table.zone_id #Add this zone_id to keep data structure consistance
|
||||||
json.current_booking table.get_current_booking.booking_id rescue ""
|
json.current_booking booking.booking_id rescue ""
|
||||||
|
json.sale_id booking.sale_id rescue ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
json.rooms zone.rooms do |room|
|
json.rooms zone.rooms do |room|
|
||||||
if room.is_active
|
if room.is_active
|
||||||
|
booking = room.get_current_booking_status
|
||||||
json.id room.id
|
json.id room.id
|
||||||
json.name room.name
|
json.name room.name
|
||||||
json.status room.status
|
json.status room.status
|
||||||
json.zone_id room.zone_id #Add this zone_id to keep data structure consistance
|
json.zone_id room.zone_id #Add this zone_id to keep data structure consistance
|
||||||
json.current_booking room.get_current_booking.booking_id rescue ""
|
json.current_booking booking.booking_id rescue ""
|
||||||
|
json.sale_id booking.sale_id rescue ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -28,21 +32,25 @@ if @zones
|
|||||||
else #list all tables and rooms with out zones
|
else #list all tables and rooms with out zones
|
||||||
json.tables @all_tables do |table|
|
json.tables @all_tables do |table|
|
||||||
if table.is_active
|
if table.is_active
|
||||||
|
booking = table.get_current_booking_status
|
||||||
json.id table.id
|
json.id table.id
|
||||||
json.name table.name
|
json.name table.name
|
||||||
json.status table.status
|
json.status table.status
|
||||||
json.zone_id table.zone_id #Add this zone_id to keep data structure consistance
|
json.zone_id table.zone_id #Add this zone_id to keep data structure consistance
|
||||||
json.current_booking table.get_current_booking.booking_id rescue ""
|
json.current_booking booking.booking_id rescue ""
|
||||||
|
json.sale_id booking.sale_id rescue ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
json.rooms @all_rooms do |room|
|
json.rooms @all_rooms do |room|
|
||||||
if room.is_active
|
if room.is_active
|
||||||
|
booking = room.get_current_booking_status
|
||||||
json.id room.id
|
json.id room.id
|
||||||
json.name room.name
|
json.name room.name
|
||||||
json.status room.status
|
json.status room.status
|
||||||
json.zone_id room.zone_id #Add this zone_id to keep data structure consistance
|
json.zone_id room.zone_id #Add this zone_id to keep data structure consistance
|
||||||
json.current_booking room.get_current_booking.booking_id rescue ""
|
json.current_booking booking.booking_id rescue ""
|
||||||
|
json.sale_id booking.sale_id rescue ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user