Martin Renvoize
31af594bb0
This patch resolves the undefined bookings_table variable issue reported and also further fixes a subsequent undefined timeline bug that was exposed by the original fix. Signed-off-by: Esther Melander <esther@bywatersolutions.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
33 lines
1,023 B
JavaScript
33 lines
1,023 B
JavaScript
$('#cancelBookingModal').on('show.bs.modal', function(e) {
|
|
var button = $(e.relatedTarget);
|
|
var booking = button.data('booking');
|
|
$('#cancel_booking_id').val(booking);
|
|
});
|
|
|
|
$("#cancelBookingForm").on('submit', function(e) {
|
|
e.preventDefault();
|
|
|
|
var booking_id = $('#cancel_booking_id').val();
|
|
var url = '/api/v1/bookings/'+booking_id;
|
|
|
|
var deleting = $.ajax({
|
|
'method': "DELETE",
|
|
'url': url
|
|
});
|
|
|
|
deleting.done(function(data) {
|
|
cancel_success = 1;
|
|
if (bookings_table) {
|
|
bookings_table.api().ajax.reload();
|
|
}
|
|
if (typeof timeline !== 'undefined') {
|
|
timeline.itemsData.remove(Number(booking_id));
|
|
}
|
|
$('.bookings_count').html(parseInt($('.bookings_count').html(), 10)-1);
|
|
$('#cancelBookingModal').modal('hide');
|
|
});
|
|
|
|
deleting.fail(function(data) {
|
|
$('#cancel_booking_result').replaceWith('<div id="booking_result" class="alert alert-danger">'+__("Failure")+'</div>');
|
|
});
|
|
});
|