Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into cloud
This commit is contained in:
@@ -36,30 +36,34 @@ class Api::CheckInProcessController < Api::ApiController
|
|||||||
if dining_facility.status == "available"
|
if dining_facility.status == "available"
|
||||||
lookup_checkout_time = Lookup.collection_of("checkout_time")
|
lookup_checkout_time = Lookup.collection_of("checkout_time")
|
||||||
|
|
||||||
checkout_at = Time.now.utc
|
if !lookup_checkout_time.empty?
|
||||||
|
checkout_at = Time.now.utc
|
||||||
|
|
||||||
if !lookup_checkout_time.nil?
|
if !lookup_checkout_time.nil?
|
||||||
if lookup_checkout_time[0][0] == 'hr'
|
if lookup_checkout_time[0][0] == 'hr'
|
||||||
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.hour
|
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.hour
|
||||||
else
|
else
|
||||||
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.minutes
|
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.minutes
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
dining_facility.status = "occupied"
|
dining_facility.status = "occupied"
|
||||||
dining_facility.save!
|
dining_facility.save!
|
||||||
|
|
||||||
if dining_facility.type == "Table"
|
if dining_facility.type == "Table"
|
||||||
type = "TableBooking"
|
type = "TableBooking"
|
||||||
|
else
|
||||||
|
type = "RoomBooking"
|
||||||
|
end
|
||||||
|
|
||||||
|
booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type,
|
||||||
|
:checkin_by=>current_login_employee.name,:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign", :reserved_at => checkout_at, :reserved_by => current_login_employee.name })
|
||||||
|
booking.save!
|
||||||
|
|
||||||
|
render :json => { :status => true, :checkout_at => booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M") }
|
||||||
else
|
else
|
||||||
type = "RoomBooking"
|
render :json => { :status => true }
|
||||||
end
|
end
|
||||||
|
|
||||||
booking = Booking.create({:dining_facility_id => params[:dining_id],:type => type,
|
|
||||||
:checkin_by=>current_login_employee.name,:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign", :reserved_at => checkout_at, :reserved_by => current_login_employee.name })
|
|
||||||
booking.save!
|
|
||||||
|
|
||||||
render :json => { :status => true, :checkout_at => booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M") }
|
|
||||||
else
|
else
|
||||||
error_message = "#{dining_facility.type} is not available!"
|
error_message = "#{dining_facility.type} is not available!"
|
||||||
render :json => { :status => false, :error_message => error_message }
|
render :json => { :status => false, :error_message => error_message }
|
||||||
|
|||||||
@@ -168,6 +168,17 @@
|
|||||||
}
|
}
|
||||||
else if(payment_type == "CUP"){
|
else if(payment_type == "CUP"){
|
||||||
$("#loading_wrapper").hide();
|
$("#loading_wrapper").hide();
|
||||||
|
swal({
|
||||||
|
title: 'Information!',
|
||||||
|
text: 'Settlement is successfully.',
|
||||||
|
type: 'success',
|
||||||
|
html: true,
|
||||||
|
closeOnConfirm: false,
|
||||||
|
closeOnCancel: false,
|
||||||
|
allowOutsideClick: false
|
||||||
|
}, function () {
|
||||||
|
window.location.href = '/origami/shift/close';
|
||||||
|
});
|
||||||
// reqCBBankAlipaySettlement();
|
// reqCBBankAlipaySettlement();
|
||||||
}
|
}
|
||||||
// else if(payment_type == "Alipay"){
|
// else if(payment_type == "Alipay"){
|
||||||
|
|||||||
Reference in New Issue
Block a user