overall void update
This commit is contained in:
28
app/controllers/origami/void_controller.rb
Normal file
28
app/controllers/origami/void_controller.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
class Origami::VoidController < BaseOrigamiController
|
||||
|
||||
def overall_void
|
||||
|
||||
sale_id = params[:sale_id]
|
||||
if Sale.exists?(sale_id)
|
||||
sale = Sale.find_by_sale_id(sale_id)
|
||||
sale.payment_status = 'void'
|
||||
sale.sale_status = 'void'
|
||||
sale.save
|
||||
|
||||
table_avaliable = true
|
||||
table = sale.bookings[0].dining_facility
|
||||
table.bookings.each do |booking|
|
||||
if booking.sale.sale_status == 'new'
|
||||
table_avaliable = false
|
||||
end
|
||||
end
|
||||
|
||||
if table_avaliable == true
|
||||
table.status = 'available'
|
||||
table.save
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user