check shift open or not

This commit is contained in:
phyusin
2018-05-24 11:36:35 +06:30
parent b4d421fdcf
commit 0970b0022e
2 changed files with 11 additions and 3 deletions

View File

@@ -48,8 +48,16 @@ class Origami::OrderReservationController < BaseOrigamiController
end
def send_status
response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],params[:status],params[:waiting_time],params[:min_type],params[:reason])
order_reservation = OrderReservation.find_by_transaction_ref(params[:ref_no])
if !order_reservation.nil?
if !ShiftSale.current_shift.nil? || params[:status] == 'accepted' || (order_reservation.status == 'new' && params[:status] == 'rejected')
response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],params[:status],params[:waiting_time],params[:min_type],params[:reason])
else
response = { status: false, message: 'No current shift open for this employee!'}
end
else
response = { status: false, message: 'There is no order for '+params[:ref_no]+'!'}
end
render :json => response
end