booking status changed

This commit is contained in:
phyusin
2018-10-03 14:17:08 +06:30
parent 9dba93ea9c
commit 7bf01a863c
4 changed files with 66 additions and 11 deletions

View File

@@ -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>