booking status changed
This commit is contained in:
@@ -53,6 +53,19 @@ class Transactions::BookingsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def update_status
|
||||
data = Booking.where("sale_id IS NULL AND booking_status='assign' AND booking_id = ?", params[:booking_id])
|
||||
if !data.nil?
|
||||
booking = Booking.find(params[:booking_id])
|
||||
booking.booking_status = 'moved'
|
||||
booking.save!
|
||||
|
||||
render :json => {:status => true, :message => "Update status successfully."}
|
||||
else
|
||||
render :json => {:status => false, :error_message => "Can't update status!"}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_transactions_booking
|
||||
|
||||
@@ -40,9 +40,14 @@
|
||||
<th> <%= t("views.right_panel.detail.checkout_by") %></th>
|
||||
<th><%= t("views.right_panel.detail.booking_status") %></th>
|
||||
<th><%= t("views.right_panel.detail.booking_date") %></th>
|
||||
<%if (@booking.sale_id.nil?) && (current_login_employee.role == "administrator") && (!@order.nil?) %>
|
||||
<%if current_login_employee.role == "administrator" %>
|
||||
<th>
|
||||
<%if (!@order.nil?) && (@booking.sale_id.nil?) %>
|
||||
<button id="request_bill" class="btn bg-blue btn-md waves-effect">Req. Bill</button>
|
||||
<% end %>
|
||||
<%if @order.nil? && @booking.booking_status == 'assign' && (@booking.sale_id.nil?) %>
|
||||
<button id="change_booking_status" class="btn bg-blue btn-md waves-effect">Update Status</button>
|
||||
<% end %>
|
||||
</th>
|
||||
<% end %>
|
||||
</tr>
|
||||
@@ -59,8 +64,14 @@
|
||||
<td><%= @booking.checkout_by rescue '-' %></td>
|
||||
<td><%= @booking.booking_status %> </td>
|
||||
<td><%= @booking.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %> </td>
|
||||
<%if (@booking.sale_id.nil?) && (current_login_employee.role == "administrator") && (!@order.nil?) %>
|
||||
<td></td>
|
||||
<%if current_login_employee.role == "administrator" %>
|
||||
<%if (!@order.nil?) && (@booking.sale_id.nil?) %>
|
||||
<td></td>
|
||||
<% end %>
|
||||
<%if @order.nil? %>
|
||||
<td></td>
|
||||
<% end %>
|
||||
</th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -175,6 +186,35 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#change_booking_status").on("click", function(){
|
||||
$('#change_booking_status').prop("disabled",true);
|
||||
var booking_id = '<%= @booking.booking_id %>';
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/transactions/bookings/update_status/"+booking_id,
|
||||
success: function (result) {
|
||||
if (!result.status) {
|
||||
$('#change_booking_status').prop("disabled",false);
|
||||
swal("Opps",result.error_message,"warning");
|
||||
}
|
||||
else {
|
||||
swal({
|
||||
title: "Information",
|
||||
text: result.message,
|
||||
type: "success",
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function() {
|
||||
// Redirect the user
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -41,21 +41,22 @@
|
||||
<th><%= t :cashier %></th>
|
||||
<th><%= t("views.right_panel.detail.sales_status") %></th>
|
||||
<th><%= t("views.right_panel.detail.receipt_generated_at") %></th>
|
||||
<% if @sale.sale_status == "completed" %>
|
||||
<% if @sale.sale_status == "new" || @sale.sale_status == "completed" %>
|
||||
<% if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %>
|
||||
<th>
|
||||
<button type="button" class="btn btn-block bg-red waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
|
||||
</th>
|
||||
<div class="form-group">
|
||||
<button type="button" class="btn btn-block bg-red waves-effect col-md-5" style="margin-top: 8px;" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
|
||||
<% end %>
|
||||
<% elsif @sale.sale_status == "new" %>
|
||||
<% end %>
|
||||
<% if @sale.sale_status == "new" %>
|
||||
<% if current_login_employee.role == "administrator" %>
|
||||
<%if @membership.discount && @sale.customer.membership_id %>
|
||||
<th>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal">Pay</button>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect col-md-5" data-toggle="modal" data-target="#paymentModal">Pay</button>
|
||||
</div>
|
||||
</th>
|
||||
<%else%>
|
||||
<th>
|
||||
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
||||
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect col-md-5">Pay</button>
|
||||
</div>
|
||||
</th>
|
||||
<%end%>
|
||||
<%end%>
|
||||
|
||||
@@ -479,6 +479,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
get "/sales/:sale_id/void" => "manual_sales#void", :as => "void"
|
||||
post "sales/:sale_id/manual_void_sale", to: "manual_sales#manual_void_sale", :as => "manual_void_sale"
|
||||
post "sales/:sale_id/:type/void" => "sales#overall_void"
|
||||
get "/bookings/update_status/:booking_id" => "bookings#update_status", :default => { :format => 'json' }
|
||||
end
|
||||
|
||||
#--------- Reports Controller Sections ------------#
|
||||
|
||||
Reference in New Issue
Block a user