Martin Renvoize
6bfe8467cb
This patch adds booking counts to the bookings option in the side menu for biblio display pages. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Janet McGowan <janet.mcgowan@ptfs-europe.com> Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> Signed-off-by: Laurence Rault <laurence.rault@biblibre.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
33 lines
990 B
JavaScript
33 lines
990 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 (timeline) {
|
|
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>');
|
|
});
|
|
});
|