|
Lines 1-22
Link Here
|
| 1 |
$(document).ready(function(){ |
1 |
$(document).ready(function(){ |
| 2 |
// Display the modal containing patron renewals details |
2 |
// Display the modal containing checkout renewals details |
| 3 |
$('.patron_renewals_view').on('click', function(e) { |
3 |
$('.checkout_renewals_view').on('click', function(e) { |
| 4 |
e.preventDefault(); |
4 |
e.preventDefault(); |
| 5 |
$('#patronRenewals #incomplete').html('').hide(); |
5 |
$('#checkoutRenewals #incomplete').html('').hide(); |
| 6 |
$('#patronRenewals #results').html('').hide(); |
6 |
$('#checkoutRenewals #results').html('').hide(); |
| 7 |
$('#patronRenewals').modal({show:true}); |
7 |
$('#checkoutRenewals').modal({show:true}); |
| 8 |
var renewals = $(this).data('renewals'); |
8 |
var renewals = $(this).data('renewals'); |
| 9 |
var checkoutID = $(this).data('issueid'); |
9 |
var checkoutID = $(this).data('issueid'); |
| 10 |
$('#patronRenewals #retrieving').show(); |
10 |
$('#checkoutRenewals #retrieving').show(); |
| 11 |
$.get({ 'url': '/api/v1/checkouts/'+checkoutID+'/renewals', 'headers': { 'x-koha-embed': 'renewer' } }, function(data) { |
11 |
$.get({ 'url': '/api/v1/checkouts/'+checkoutID+'/renewals', 'headers': { 'x-koha-embed': 'renewer' } }, function(data) { |
| 12 |
if (data.length < renewals) { |
12 |
if (data.length < renewals) { |
| 13 |
$('#patronRenewals #incomplete').append(renewed_prop.format(data.length, renewals)).show(); |
13 |
$('#checkoutRenewals #incomplete').append(renewed_prop.format(data.length, renewals)).show(); |
| 14 |
} |
14 |
} |
| 15 |
var items = data.map(function(item) { |
15 |
var items = data.map(function(item) { |
| 16 |
return createLi(item); |
16 |
return createLi(item); |
| 17 |
}); |
17 |
}); |
| 18 |
$('#patronRenewals #retrieving').hide(); |
18 |
$('#checkoutRenewals #retrieving').hide(); |
| 19 |
$('#patronRenewals #results').append(items).show(); |
19 |
$('#checkoutRenewals #results').append(items).show(); |
| 20 |
}); |
20 |
}); |
| 21 |
}); |
21 |
}); |
| 22 |
function createLi(renewal) { |
22 |
function createLi(renewal) { |
| 23 |
- |
|
|