fix table booking
This commit is contained in:
@@ -9,10 +9,10 @@ class DiningFacility < ApplicationRecord
|
||||
has_many :order_queue_stations, -> { where(is_active: true) }, through: :order_queue_process_by_zones
|
||||
|
||||
has_many :bookings
|
||||
has_many :current_bookings, -> { left_joins(:sale).assign.merge(Booking.where(checkout_at: nil).or(Booking.merge(Sale.where(sale_status: ['new', nil])))) }, class_name: "Booking"
|
||||
has_one :current_checkin_booking, -> { left_joins(:sale).assign.merge(Sale.where(sale_status: nil)) }, class_name: "Booking"
|
||||
has_one :current_checkout_booking, -> { left_joins(:sale).assign.where.not(checkout_at: nil).merge(Sale.where(sale_status: 'new')) }, class_name: "Booking"
|
||||
has_one :current_reserved_booking, -> { left_joins(:sale).assign.where.not(reserved_at: nil).merge(Sale.where(sale_status: nil)) }, class_name: "Booking"
|
||||
has_many :current_bookings, -> { left_joins(:sale).assign.merge(Booking.unscoped.where(checkout_at: nil).or(Booking.merge(Sale.unscoped.where(sale_status: ['new', nil])))) }, class_name: "Booking"
|
||||
has_one :current_checkin_booking, -> { left_joins(:sale).assign.merge(Sale.unscoped.where(sale_status: nil)) }, class_name: "Booking"
|
||||
has_one :current_checkout_booking, -> { left_joins(:sale).assign.where.not(checkout_at: nil).merge(Sale.unscoped.where(sale_status: 'new')) }, class_name: "Booking"
|
||||
has_one :current_reserved_booking, -> { left_joins(:sale).assign.where.not(reserved_at: nil).merge(Sale.unscoped.where(sale_status: nil)) }, class_name: "Booking"
|
||||
|
||||
has_many :current_sales, -> { where(sale_status: 'new').merge(Booking.assign) }, through: :bookings, class_name: "Sale", source: "sale"
|
||||
|
||||
|
||||
@@ -831,6 +831,7 @@
|
||||
var sale_id = this.id;
|
||||
window.location.href = '/origami/table/' + dining_id + "/table_invoice/" + sale_id;
|
||||
})
|
||||
|
||||
$(".tables").on('click', function () {
|
||||
localStorage.setItem('dinning_type','table');
|
||||
var customer_id = $(".customer-id").text();
|
||||
@@ -1156,6 +1157,8 @@
|
||||
})
|
||||
|
||||
$('#add_invoice').on('click', function () {
|
||||
$("#loading_wrapper").show();
|
||||
$("#add_invoice").prop('disable', true);
|
||||
$("#first_bill").prop('disabled',true);
|
||||
$("#pay").prop('disabled',true);
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
@@ -1180,6 +1183,7 @@
|
||||
$("#pay").removeAttr('disabled');
|
||||
window.location.reload();
|
||||
});
|
||||
$("#loading_wrapper").hide();
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user