table status update

This commit is contained in:
Nweni
2017-06-12 14:35:59 +06:30
parent 105581a7de
commit 59520bf7ec
2 changed files with 11 additions and 4 deletions

View File

@@ -215,14 +215,21 @@ class SalePayment < ApplicationRecord
self.sale.payment_status = "paid" self.sale.payment_status = "paid"
self.sale.sale_status = "completed" self.sale.sale_status = "completed"
self.sale.save! self.sale.save!
table_update_status() table_update_status(sObj)
rebat() rebat()
end end
end end
def table_update_status def table_update_status(sale_obj)
booking = Booking.find_by_sale_id(sale_obj.id)
if booking
table = DiningFacility.find(booking.dining_facility_id)
if table
table.status = "available"
table.save
end
end
end end
def rebat def rebat

View File

@@ -233,7 +233,7 @@ $( document ).ready(function() {
data: "cash="+ cash + "&sale_id=" + sale_id, data: "cash="+ cash + "&sale_id=" + sale_id,
success:function(result){ success:function(result){
alert("Thank you") alert("Thank you")
// window.location.href = '/origami'; window.location.href = '/origami';
} }
}); });
} }