booking status changed
This commit is contained in:
@@ -53,6 +53,19 @@ class Transactions::BookingsController < ApplicationController
|
|||||||
end
|
end
|
||||||
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
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_transactions_booking
|
def set_transactions_booking
|
||||||
|
|||||||
@@ -40,9 +40,14 @@
|
|||||||
<th> <%= t("views.right_panel.detail.checkout_by") %></th>
|
<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_status") %></th>
|
||||||
<th><%= t("views.right_panel.detail.booking_date") %></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>
|
<th>
|
||||||
|
<%if (!@order.nil?) && (@booking.sale_id.nil?) %>
|
||||||
<button id="request_bill" class="btn bg-blue btn-md waves-effect">Req. Bill</button>
|
<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>
|
</th>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -59,8 +64,14 @@
|
|||||||
<td><%= @booking.checkout_by rescue '-' %></td>
|
<td><%= @booking.checkout_by rescue '-' %></td>
|
||||||
<td><%= @booking.booking_status %> </td>
|
<td><%= @booking.booking_status %> </td>
|
||||||
<td><%= @booking.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %> </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?) %>
|
<%if current_login_employee.role == "administrator" %>
|
||||||
<td></td>
|
<%if (!@order.nil?) && (@booking.sale_id.nil?) %>
|
||||||
|
<td></td>
|
||||||
|
<% end %>
|
||||||
|
<%if @order.nil? %>
|
||||||
|
<td></td>
|
||||||
|
<% end %>
|
||||||
|
</th>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</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>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,21 +41,22 @@
|
|||||||
<th><%= t :cashier %></th>
|
<th><%= t :cashier %></th>
|
||||||
<th><%= t("views.right_panel.detail.sales_status") %></th>
|
<th><%= t("views.right_panel.detail.sales_status") %></th>
|
||||||
<th><%= t("views.right_panel.detail.receipt_generated_at") %></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" %>
|
<% if current_login_employee.role == "administrator" || current_login_employee.role == "manager" %>
|
||||||
<th>
|
<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>
|
<div class="form-group">
|
||||||
</th>
|
<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 %>
|
<% end %>
|
||||||
<% elsif @sale.sale_status == "new" %>
|
<% end %>
|
||||||
|
<% if @sale.sale_status == "new" %>
|
||||||
<% if current_login_employee.role == "administrator" %>
|
<% if current_login_employee.role == "administrator" %>
|
||||||
<%if @membership.discount && @sale.customer.membership_id %>
|
<%if @membership.discount && @sale.customer.membership_id %>
|
||||||
<th>
|
<button type="button" class="btn btn-block bg-blue waves-effect col-md-5" data-toggle="modal" data-target="#paymentModal">Pay</button>
|
||||||
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal">Pay</button>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
<%else%>
|
<%else%>
|
||||||
<th>
|
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect col-md-5">Pay</button>
|
||||||
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
<%end%>
|
<%end%>
|
||||||
<%end%>
|
<%end%>
|
||||||
|
|||||||
@@ -479,6 +479,7 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
get "/sales/:sale_id/void" => "manual_sales#void", :as => "void"
|
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/manual_void_sale", to: "manual_sales#manual_void_sale", :as => "manual_void_sale"
|
||||||
post "sales/:sale_id/:type/void" => "sales#overall_void"
|
post "sales/:sale_id/:type/void" => "sales#overall_void"
|
||||||
|
get "/bookings/update_status/:booking_id" => "bookings#update_status", :default => { :format => 'json' }
|
||||||
end
|
end
|
||||||
|
|
||||||
#--------- Reports Controller Sections ------------#
|
#--------- Reports Controller Sections ------------#
|
||||||
|
|||||||
Reference in New Issue
Block a user