+
<%= @i += 1 %> . <%= booking.dining_facility.name %>
- <%= booking.id %>
@@ -20,10 +21,10 @@
@@ -42,16 +43,16 @@ $(function(){
});
$('.assign').click(function(e){
- var booking_id = $('#assign').attr('data-booking-ref');
- alert(booking_id);
- var type = $('#assign').attr('data-type');
+ var booking_id = $(this).attr("data-id")
+ var type = $(this).attr("data-type")
+
update_booking(booking_id,type)
});
$('.cancel').click(function(e){
- var booking_id = $('#cancel').attr('data-booking-ref');
- alert(booking_id);
- var type = $('#cancel').attr('data-type');
+ var booking_id = $(this).attr("data-id")
+ var type = $(this).attr("data-type")
+
update_booking(booking_id,type)
});
@@ -95,9 +96,15 @@ function update_booking(booking_id,type) {
type: "POST",
url: "crm/update_booking/" ,
data: {booking_id:booking_id,type:type},
- // dataType: "json",
+ dataType: "json",
success: function(data) {
-
+ if(data.status == true && data.type == "cancel")
+ {
+ alert('Booking has canceled!');
+ }else{
+ alert('Booking has completed!');
+ }
+ location.reload();
}
});
}